pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix ./configure checks with __cpuidex() and __cpuid()
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix ./configure checks with __cpuidex() and __cpuid()
@ 2025-07-30 02:56 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2025-07-30 02:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1a5212775e46fd573e74c9213392177920f0efd6

Modified Files
--------------
configure    | 63 +++++++++++++++++++++++++++++++-----------------------------
configure.ac | 49 ++++++++++++++++++++++++----------------------
meson.build  |  5 +----
3 files changed, 60 insertions(+), 57 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix ./configure checks with __cpuidex() and __cpuid()
@ 2025-07-30 02:56 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2025-07-30 02:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/cd2d52cc6b394b2e9f11ff870dd727d16765c9c4

Modified Files
--------------
configure    | 63 +++++++++++++++++++++++++++++++-----------------------------
configure.ac | 49 ++++++++++++++++++++++++----------------------
meson.build  |  5 +----
3 files changed, 60 insertions(+), 57 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix ./configure checks with __cpuidex() and __cpuid()
@ 2025-07-30 02:56 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2025-07-30 02:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8de56323c1396626a9d667a0dfe6e1c3a8ca1637

Modified Files
--------------
configure    | 63 +++++++++++++++++++++++++++++++-----------------------------
configure.ac | 49 ++++++++++++++++++++++++----------------------
meson.build  |  5 +----
3 files changed, 60 insertions(+), 57 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix ./configure checks with __cpuidex() and __cpuid()
@ 2025-07-30 02:56 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2025-07-30 02:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c1984be23cdc3aa74d1fd7bb28a4acaaa6813687

Modified Files
--------------
configure    | 13 +++++++------
configure.ac | 25 +++++++++++++------------
2 files changed, 20 insertions(+), 18 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix ./configure checks with __cpuidex() and __cpuid()
@ 2025-07-30 02:56 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2025-07-30 02:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d6ffc43f95b215fbedba102d343cd31cdd3a5ca7

Modified Files
--------------
configure    | 13 +++++++------
configure.ac | 25 +++++++++++++------------
2 files changed, 20 insertions(+), 18 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix ./configure checks with __cpuidex() and __cpuid()
@ 2025-07-30 02:56 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2025-07-30 02:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/60953d4cba7cce4a8672b1930d173077ac1130fc

Modified Files
--------------
configure    | 13 +++++++------
configure.ac | 25 +++++++++++++------------
2 files changed, 20 insertions(+), 18 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix ./configure checks with __cpuidex() and __cpuid()
@ 2025-07-30 02:56 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2025-07-30 02:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/612f5b80620da0f38b39f48ab545be5c079f621a

Modified Files
--------------
configure    | 13 +++++++------
configure.in | 25 +++++++++++++------------
2 files changed, 20 insertions(+), 18 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2025-07-30 02:56 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-07-30 02:56 pgsql: Fix ./configure checks with __cpuidex() and __cpuid() Michael Paquier <michael@paquier.xyz>
2025-07-30 02:56 pgsql: Fix ./configure checks with __cpuidex() and __cpuid() Michael Paquier <michael@paquier.xyz>
2025-07-30 02:56 pgsql: Fix ./configure checks with __cpuidex() and __cpuid() Michael Paquier <michael@paquier.xyz>
2025-07-30 02:56 pgsql: Fix ./configure checks with __cpuidex() and __cpuid() Michael Paquier <michael@paquier.xyz>
2025-07-30 02:56 pgsql: Fix ./configure checks with __cpuidex() and __cpuid() Michael Paquier <michael@paquier.xyz>
2025-07-30 02:56 pgsql: Fix ./configure checks with __cpuidex() and __cpuid() Michael Paquier <michael@paquier.xyz>
2025-07-30 02:56 pgsql: Fix ./configure checks with __cpuidex() and __cpuid() Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox