diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 16e7231214af2df..5e100da7a424172 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -212,7 +212,7 @@ static const double logpi = 1.144729885849400174143427351353058711647; } \ } -#ifndef HAVE_ACOSPI +#ifndef _Py_HAVE_ACOSPI /* acos(x)/pi. It conforms to C23 Annex 'F'. */ @@ -236,7 +236,7 @@ m_acospi(double x) #define m_acospi acospi #endif -#ifndef HAVE_ASINPI +#ifndef _Py_HAVE_ASINPI /* asin(x)/pi. It conforms to C23 Annex 'F'. */ @@ -254,7 +254,7 @@ m_asinpi(double x) #define m_asinpi asinpi #endif -#ifndef HAVE_ATANPI +#ifndef _Py_HAVE_ATANPI /* atan(x)/pi. It conforms to C23 Annex 'F'. */ @@ -272,7 +272,7 @@ m_atanpi(double x) #define m_atanpi atanpi #endif -#ifndef HAVE_ATAN2PI +#ifndef _Py_HAVE_ATAN2PI /* atan2(y, x)/pi. It conforms to C23 Annex 'F'. */ @@ -290,7 +290,7 @@ m_atan2pi(double y, double x) #define m_atan2pi atan2pi #endif -#ifndef HAVE_COSPI +#ifndef _Py_HAVE_COSPI /* cos(pi*x), giving accurate results for all finite x (especially x integral or close to an integer). It conforms to C23 Annex 'F'. @@ -318,7 +318,7 @@ m_cospi(double x) #define m_cospi cospi #endif -#ifndef HAVE_SINPI +#ifndef _Py_HAVE_SINPI /* sin(pi*x), giving accurate results for all finite x (especially x integral or close to an integer). It conforms to C23 Annex 'F'. @@ -362,7 +362,7 @@ m_sinpi(double x) #define m_sinpi sinpi #endif -#ifndef HAVE_TANPI +#ifndef _Py_HAVE_TANPI /* tan(pi*x), giving accurate results for all finite x (especially x integral or close to an integer). It conforms to C23 Annex 'F'. diff --git a/configure b/configure index 9af81bf7cc67d1d..2b72ba57d1f0630 100755 --- a/configure +++ b/configure @@ -642,7 +642,6 @@ ac_includes_default="\ #endif" ac_header_c_list= -ac_func_c_list= ac_subst_vars='LTLIBOBJS MODULE_BLOCK JIT_SHIM_BUILD_O @@ -3440,13 +3439,6 @@ as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H" as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H" -as_fn_append ac_func_c_list " acospi HAVE_ACOSPI" -as_fn_append ac_func_c_list " asinpi HAVE_ASINPI" -as_fn_append ac_func_c_list " atanpi HAVE_ATANPI" -as_fn_append ac_func_c_list " atan2pi HAVE_ATAN2PI" -as_fn_append ac_func_c_list " cospi HAVE_COSPI" -as_fn_append ac_func_c_list " sinpi HAVE_SINPI" -as_fn_append ac_func_c_list " tanpi HAVE_TANPI" # Auxiliary files required by this configure script. ac_aux_files="install-sh config.guess config.sub" @@ -3625,6 +3617,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then # If we're building out-of-tree, we need to make sure the following # resources get picked up before their $srcdir counterparts. @@ -27591,24 +27585,298 @@ fi done -ac_func= -for ac_item in $ac_func_c_list -do - if test $ac_func; then - ac_fn_c_check_func "$LINENO" $ac_func ac_cv_func_$ac_func - if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then - echo "#define $ac_item 1" >> confdefs.h - fi - ac_func= - else - ac_func=$ac_item - fi -done + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for acospi" >&5 +printf %s "checking for acospi... " >&6; } +if test ${ac_cv_func_acospi+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +void *x=acospi + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_func_acospi=yes +else case e in #( + e) ac_cv_func_acospi=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_acospi" >&5 +printf "%s\n" "$ac_cv_func_acospi" >&6; } + if test "x$ac_cv_func_acospi" = xyes +then : + +printf "%s\n" "#define _Py_HAVE_ACOSPI 1" >>confdefs.h + +fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for asinpi" >&5 +printf %s "checking for asinpi... " >&6; } +if test ${ac_cv_func_asinpi+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +void *x=asinpi + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_func_asinpi=yes +else case e in #( + e) ac_cv_func_asinpi=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_asinpi" >&5 +printf "%s\n" "$ac_cv_func_asinpi" >&6; } + if test "x$ac_cv_func_asinpi" = xyes +then : + +printf "%s\n" "#define _Py_HAVE_ASINPI 1" >>confdefs.h + +fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for atanpi" >&5 +printf %s "checking for atanpi... " >&6; } +if test ${ac_cv_func_atanpi+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +void *x=atanpi + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_func_atanpi=yes +else case e in #( + e) ac_cv_func_atanpi=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_atanpi" >&5 +printf "%s\n" "$ac_cv_func_atanpi" >&6; } + if test "x$ac_cv_func_atanpi" = xyes +then : + +printf "%s\n" "#define _Py_HAVE_ATANPI 1" >>confdefs.h + +fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for atan2pi" >&5 +printf %s "checking for atan2pi... " >&6; } +if test ${ac_cv_func_atan2pi+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +void *x=atan2pi + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_func_atan2pi=yes +else case e in #( + e) ac_cv_func_atan2pi=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_atan2pi" >&5 +printf "%s\n" "$ac_cv_func_atan2pi" >&6; } + if test "x$ac_cv_func_atan2pi" = xyes +then : + +printf "%s\n" "#define _Py_HAVE_ATAN2PI 1" >>confdefs.h + +fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cospi" >&5 +printf %s "checking for cospi... " >&6; } +if test ${ac_cv_func_cospi+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +void *x=cospi + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_func_cospi=yes +else case e in #( + e) ac_cv_func_cospi=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_cospi" >&5 +printf "%s\n" "$ac_cv_func_cospi" >&6; } + if test "x$ac_cv_func_cospi" = xyes +then : + +printf "%s\n" "#define _Py_HAVE_COSPI 1" >>confdefs.h + +fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sinpi" >&5 +printf %s "checking for sinpi... " >&6; } +if test ${ac_cv_func_sinpi+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +void *x=sinpi + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_func_sinpi=yes +else case e in #( + e) ac_cv_func_sinpi=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_sinpi" >&5 +printf "%s\n" "$ac_cv_func_sinpi" >&6; } + if test "x$ac_cv_func_sinpi" = xyes +then : + +printf "%s\n" "#define _Py_HAVE_SINPI 1" >>confdefs.h + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tanpi" >&5 +printf %s "checking for tanpi... " >&6; } +if test ${ac_cv_func_tanpi+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +void *x=tanpi + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_func_tanpi=yes +else case e in #( + e) ac_cv_func_tanpi=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_tanpi" >&5 +printf "%s\n" "$ac_cv_func_tanpi" >&6; } + if test "x$ac_cv_func_tanpi" = xyes +then : + +printf "%s\n" "#define _Py_HAVE_TANPI 1" >>confdefs.h + +fi + + LIBS=$LIBS_SAVE diff --git a/configure.ac b/configure.ac index 92d7c17a6b448ba..439e244e030af53 100644 --- a/configure.ac +++ b/configure.ac @@ -73,6 +73,12 @@ AC_DEFUN([PY_CHECK_FUNC], AS_VAR_POPDEF([py_define]) ]) +dnl PY_CHECK_FUNC_PRIVATE(FUNCTION, [INCLUDES], [AC_DEFINE-VAR]) +dnl Similar to PY_CHECK_FUNC but define macro _Py_HAVE_xxx instead of HAVE_xxx +AC_DEFUN([PY_CHECK_FUNC_PRIVATE], +[ PY_CHECK_FUNC([$1], [$2], m4_ifblank([$3], [[_Py_HAVE_]m4_toupper($1)], [$3])) +]) + dnl PY_CHECK_LIB(LIBRARY, FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES]) dnl Like AC_CHECK_LIB() but does not modify LIBS AC_DEFUN([PY_CHECK_LIB], @@ -6552,7 +6558,13 @@ AC_CHECK_FUNCS( [AC_MSG_ERROR([Python requires C99 compatible libm])] ) -AC_CHECK_FUNCS_ONCE(acospi asinpi atanpi atan2pi cospi sinpi tanpi) +PY_CHECK_FUNC_PRIVATE([acospi]) +PY_CHECK_FUNC_PRIVATE([asinpi]) +PY_CHECK_FUNC_PRIVATE([atanpi]) +PY_CHECK_FUNC_PRIVATE([atan2pi]) +PY_CHECK_FUNC_PRIVATE([cospi]) +PY_CHECK_FUNC_PRIVATE([sinpi]) +PY_CHECK_FUNC_PRIVATE([tanpi]) LIBS=$LIBS_SAVE dnl For multiprocessing module, check that sem_open diff --git a/pyconfig.h.in b/pyconfig.h.in index 2bf45a290a4ed17..5d6a83bbbc61551 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -55,9 +55,6 @@ /* Define to 1 if you have the 'acosh' function. */ #undef HAVE_ACOSH -/* Define to 1 if you have the 'acospi' function. */ -#undef HAVE_ACOSPI - /* struct addrinfo (netdb.h) */ #undef HAVE_ADDRINFO @@ -76,21 +73,12 @@ /* Define to 1 if you have the 'asinh' function. */ #undef HAVE_ASINH -/* Define to 1 if you have the 'asinpi' function. */ -#undef HAVE_ASINPI - /* Define to 1 if you have the header file. */ #undef HAVE_ASM_TYPES_H -/* Define to 1 if you have the 'atan2pi' function. */ -#undef HAVE_ATAN2PI - /* Define to 1 if you have the 'atanh' function. */ #undef HAVE_ATANH -/* Define to 1 if you have the 'atanpi' function. */ -#undef HAVE_ATANPI - /* Define to 1 if you have the 'backtrace' function. */ #undef HAVE_BACKTRACE @@ -191,9 +179,6 @@ /* Define to 1 if you have the 'copy_file_range' function. */ #undef HAVE_COPY_FILE_RANGE -/* Define to 1 if you have the 'cospi' function. */ -#undef HAVE_COSPI - /* Define to 1 if you have the 'ctermid' function. */ #undef HAVE_CTERMID @@ -1384,9 +1369,6 @@ /* Define to 1 if you have the 'sigwaitinfo' function. */ #undef HAVE_SIGWAITINFO -/* Define to 1 if you have the 'sinpi' function. */ -#undef HAVE_SINPI - /* Define to 1 if you have the 'snprintf' function. */ #undef HAVE_SNPRINTF @@ -1665,9 +1647,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_XATTR_H -/* Define to 1 if you have the 'tanpi' function. */ -#undef HAVE_TANPI - /* Define to 1 if you have the 'tcgetpgrp' function. */ #undef HAVE_TCGETPGRP @@ -2203,6 +2182,21 @@ /* HACL* library can compile SIMD256 implementations */ #undef _Py_HACL_CAN_COMPILE_VEC256 +/* Define if you have the 'acospi' function. */ +#undef _Py_HAVE_ACOSPI + +/* Define if you have the 'asinpi' function. */ +#undef _Py_HAVE_ASINPI + +/* Define if you have the 'atan2pi' function. */ +#undef _Py_HAVE_ATAN2PI + +/* Define if you have the 'atanpi' function. */ +#undef _Py_HAVE_ATANPI + +/* Define if you have the 'cospi' function. */ +#undef _Py_HAVE_COSPI + /* Define if compiler supports __builtin_shufflevector with 128-bit vectors AND the target architecture has native SIMD (not just API availability) */ #undef _Py_HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR @@ -2217,6 +2211,12 @@ /* Define if you have the 'PR_SET_VMA_ANON_NAME' constant. */ #undef _Py_HAVE_PR_SET_VMA_ANON_NAME +/* Define if you have the 'sinpi' function. */ +#undef _Py_HAVE_SINPI + +/* Define if you have the 'tanpi' function. */ +#undef _Py_HAVE_TANPI + /* Thread stack size set by the linker (in bytes). */ #undef _Py_LINKER_THREAD_STACK_SIZE