Skip to content

gh-125269: Use AC_LINK_IF_ELSE to detect if -latomic is needed #125416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix detection of whether ``-latomic`` is needed when cross-compiling CPython
using the configure script.
12 changes: 3 additions & 9 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -7497,7 +7497,7 @@ CPPFLAGS="${BASECPPFLAGS} -I. -I${srcdir}/Include ${CPPFLAGS}"

AC_CACHE_CHECK([whether libatomic is needed by <pyatomic.h>],
[ac_cv_libatomic_needed],
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
[AC_LINK_IFELSE([AC_LANG_SOURCE([[
// pyatomic.h needs uint64_t and Py_ssize_t types
#include <stdint.h> // int64_t, intptr_t
#ifdef HAVE_SYS_TYPES_H
Expand Down Expand Up @@ -7534,9 +7534,8 @@ int main()
return 0; // all good
}
]])],
[ac_cv_libatomic_needed=no], dnl build succeeded
[ac_cv_libatomic_needed=yes], dnl build failed
[ac_cv_libatomic_needed=no]) dnl cross compilation
[ac_cv_libatomic_needed=no], dnl build and link succeeded
[ac_cv_libatomic_needed=yes]) dnl build and link failed
])

AS_VAR_IF([ac_cv_libatomic_needed], [yes],
Expand Down
Loading