Skip to content

Commit

Permalink
fix: no gmp.h should not result in configure error for `--with-back…
Browse files Browse the repository at this point in the history
…end=auto`
  • Loading branch information
UdjinM6 committed Sep 25, 2024
1 parent 2494170 commit b4cefa6
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -159,37 +159,39 @@ if test x"$has_gmp" != x"yes"; then
AC_CHECK_HEADER(
gmp.h,
[AC_CHECK_LIB(gmp, __gmpz_init, [], [AC_MSG_ERROR([libgmp not found or unusable])])],
[AC_MSG_ERROR([gmp header not found])]
[has_gmp=no]
)
# Proper support for macOS aarch64 was introduced in 6.3.0, but LTS distros
# like Ubuntu 20.04 (focal) use 6.2.0, so, the minimum supported version is
# determined by platform and architecture.
case $host in
*darwin*)
case $host_cpu in
aarch*)
gmp_major_version=6
gmp_minor_version=3
;;
esac
;;
*)
gmp_major_version=6
gmp_minor_version=2
;;
esac
AC_MSG_CHECKING([gmp version >= $gmp_major_version.$gmp_minor_version])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[@%:@include <gmp.h>]],
[[
@%:@if __GNU_MP_VERSION < $gmp_major_version || __GNU_MP_VERSION_MINOR < $gmp_minor_version
@%:@error Unsupported GMP version
@%:@endif]])],
[AC_MSG_RESULT([yes]); has_gmp=yes; GMP_LIBS="-lgmp";],
[AC_MSG_RESULT([no]); AC_MSG_ERROR([unsupported gmp version])]
)
if test x"$has_gmp" != x"no"; then
# Proper support for macOS aarch64 was introduced in 6.3.0, but LTS distros
# like Ubuntu 20.04 (focal) use 6.2.0, so, the minimum supported version is
# determined by platform and architecture.
case $host in
*darwin*)
case $host_cpu in
aarch*)
gmp_major_version=6
gmp_minor_version=3
;;
esac
;;
*)
gmp_major_version=6
gmp_minor_version=2
;;
esac
AC_MSG_CHECKING([gmp version >= $gmp_major_version.$gmp_minor_version])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[@%:@include <gmp.h>]],
[[
@%:@if __GNU_MP_VERSION < $gmp_major_version || __GNU_MP_VERSION_MINOR < $gmp_minor_version
@%:@error Unsupported GMP version
@%:@endif]])],
[AC_MSG_RESULT([yes]); has_gmp=yes; GMP_LIBS="-lgmp";],
[AC_MSG_RESULT([no]); AC_MSG_ERROR([unsupported gmp version])]
)
fi
CPPFLAGS="$CPPFLAGS_TEMP"
LIBS="$LIBS_TEMP"
Expand Down

0 comments on commit b4cefa6

Please sign in to comment.