Skip to content
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

gh-109054: Don't use libatomic on cross-compilation #109211

Merged
merged 1 commit into from
Sep 10, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions configure

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

7 changes: 4 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -7007,9 +7007,10 @@ int main()
}
return 0; // all good
}
]])],[
ac_cv_libatomic_needed=no
],[ac_cv_libatomic_needed=yes],[ac_cv_libatomic_needed=yes])
]])],
[ac_cv_libatomic_needed=no], dnl build succeeded
[ac_cv_libatomic_needed=yes], dnl build failed
[ac_cv_libatomic_needed=no]) dnl cross compilation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have used ac_cv_libatomic_needed=n/a for a more accurate result message.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't know this value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't know this value.

Actually, the value is up to you; it's not a magical GNU Autoconf value :) See docs for AC_CACHE_CHECK. The signature for that macro is:

AC_CACHE_CHECK (message, cache-id, commands-to-set-it)

Quoting the docs:

It calls AC_MSG_CHECKING for message, then AC_CACHE_VAL with the cache-id and commands arguments, and AC_MSG_RESULT with cache-id.

In out case, cache-id is ac_cv_libatomic_needed. Whatever we set it to will be displayed to the user at the end of the check (via the implicit AC_MSG_RESULT call). So if we set ac_cv_libatomic_needed to n/a, the user should see this when cross-compiling:

checking whether libatomic is needed by <pyatomic.h>... n/a

Currently, the user will see this when cross-compiling:

checking whether libatomic is needed by <pyatomic.h>... no

The "no" may lead the user to incorrectly assume that configure actually checked whether libatomic was needed (and that configure concluded it was not).

I think it may be worth it to adjust this message. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, my suggestion is made moot by #109344

])

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