@@ -3974,23 +3974,46 @@ AC_ARG_WITH(
39743974 [ system_libmpdec] ,
39753975 [ AS_HELP_STRING (
39763976 [ --with-system-libmpdec] ,
3977- [ build _decimal module using an installed libmpdec library, see Doc/library/decimal.rst (default is no )]
3977+ [ build _decimal module using an installed mpdecimal library, see Doc/library/decimal.rst (default is yes )]
39783978 ) ] ,
39793979 [ ] ,
3980- [ with_system_libmpdec="no "] )
3980+ [ with_system_libmpdec="yes "] )
39813981AC_MSG_RESULT ( [ $with_system_libmpdec] )
39823982
39833983AS_VAR_IF (
39843984 [ with_system_libmpdec] , [ yes] ,
39853985 [ PKG_CHECK_MODULES(
3986- [ LIBMPDEC] , [ libmpdec] , [ ] ,
3986+ [ LIBMPDEC] , [ libmpdec >= 2.5.0 ] , [ ] ,
39873987 [ LIBMPDEC_CFLAGS=${LIBMPDEC_CFLAGS-""}
39883988 LIBMPDEC_LIBS=${LIBMPDEC_LIBS-"-lmpdec -lm"}
39893989 LIBMPDEC_INTERNAL=] )] ,
39903990 [ LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec"
39913991 LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)"
39923992 LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"] )
39933993
3994+ AS_VAR_IF ( [ with_system_libmpdec] , [ yes] ,
3995+ [ WITH_SAVE_ENV([
3996+ CPPFLAGS="$LIBMPDEC_CFLAGS $CPPFLAGS"
3997+ LIBS="$LIBMPDEC_LIBS $LIBS"
3998+
3999+ AC_LINK_IFELSE ( [
4000+ AC_LANG_PROGRAM ( [
4001+ #include <mpdecimal.h>
4002+ #if MPD_VERSION_HEX < 0x02050000
4003+ # error "mpdecimal 2.5.0 or higher required"
4004+ #endif
4005+ ] , [ const char *x = mpd_version();] ) ] ,
4006+ [ have_mpdec=yes] ,
4007+ [ have_mpdec=no] )
4008+ ] )] ,
4009+ [ AS_VAR_SET ( [ have_mpdec] , [ yes] )
4010+ AC_MSG_WARN ( [ m4_normalize ( [
4011+ the bundled copy of libmpdecimal is scheduled for removal in Python 3.15;
4012+ consider using a system installed mpdecimal library.] ) ] ) ] )
4013+
4014+ AS_IF ( [ test "$with_system_libmpdec" = "yes" && test "$have_mpdec" = "no"] ,
4015+ [ AC_MSG_WARN ( [ no system libmpdecimal found; unable to build _decimal] ) ] )
4016+
39944017# Disable forced inlining in debug builds, see GH-94847
39954018AS_VAR_IF (
39964019 [ with_pydebug] , [ yes] ,
@@ -7668,7 +7691,9 @@ PY_STDLIB_MOD([_curses_panel],
76687691 [ ] , [ test "$have_panel" != "no"] ,
76697692 [ $PANEL_CFLAGS $CURSES_CFLAGS] , [ $PANEL_LIBS $CURSES_LIBS]
76707693)
7671- PY_STDLIB_MOD([ _decimal] , [ ] , [ ] , [ $LIBMPDEC_CFLAGS] , [ $LIBMPDEC_LIBS] )
7694+ PY_STDLIB_MOD([ _decimal] ,
7695+ [ ] , [ test "$have_mpdec" = "yes"] ,
7696+ [ $LIBMPDEC_CFLAGS] , [ $LIBMPDEC_LIBS] )
76727697PY_STDLIB_MOD([ _dbm] ,
76737698 [ test -n "$with_dbmliborder"] , [ test "$have_dbm" != "no"] ,
76747699 [ $DBM_CFLAGS] , [ $DBM_LIBS] )
0 commit comments