Skip to content

Commit e6d5a81

Browse files
t-a-kkhwilliamson
authored andcommitted
Configure: check usability of <stdckdint.h>, not only its existence
Some FreeBSD systems have <stdckdint.h>, but it cannot be compiled with C++ compilers. Configure now checks whether `ckd_*` functions can be compiled, and leave I_STDCKDINT undefined if the compilation failed. Will fix GH #23725 (d51aa1a build-time failure with clang++ and g++).
1 parent 5fdb3e5 commit e6d5a81

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

Configure

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24228,8 +24228,41 @@ set i_stdbool
2422824228
eval $setvar
2422924229

2423024230
: see if C23 stdckdint is available
24231-
set stdckdint.h i_stdckdint
24232-
eval $inhdr
24231+
: we want a real compile instead of Inhdr because some FreeBSD systems
24232+
: have stdckdint.h, but it is not compatible with C++.
24233+
case "$i_stdckdint" in
24234+
'')
24235+
echo " "
24236+
$cat >try.c <<EOCP
24237+
#include <stdio.h>
24238+
#include <stdckdint.h>
24239+
int func(long *resultptr, long a, long b)
24240+
{
24241+
return (ckd_add(resultptr, a, b) ||
24242+
ckd_sub(resultptr, a, b) ||
24243+
ckd_mul(resultptr, a, b)) ? 1 : 0;
24244+
}
24245+
int main(int argc, char **argv)
24246+
{
24247+
long result;
24248+
return func(&result, 42L, 53L);
24249+
}
24250+
EOCP
24251+
set try
24252+
if eval $compile; then
24253+
echo "<stdckdint.h> found." >&4
24254+
val="$define"
24255+
else
24256+
echo "<stdckdint.h> NOT found." >&4
24257+
val="$undef"
24258+
fi ;;
24259+
*)
24260+
val="$i_stdckdint" ;;
24261+
esac
24262+
24263+
$rm_try
24264+
set i_stdckdint
24265+
eval $setvar
2423324266

2423424267
: see if stdint is available
2423524268
set stdint.h i_stdint

0 commit comments

Comments
 (0)