Tuesday, June 11, 2019

Re: audio/audacity -latomic

On Tue, May 21 2019, Raphael Graf <r@undefined.ch> wrote:
> The diff below fixes linking on macppc.

Looks like this one fell through the cracks. ok jca@

> Is there a better way to check if '-latomic' is needed?

The audacity source code uses:

std::atomic<bool>
std::atomic<double>
std::atomic<size_t>

So I guess testing for std::int64_t is enough for us, sizeof(double)
should be 8 bytes on all our platforms. AFAIK -latomic is only needed
for 8 bytes atomics on powerpc (and maybe hppa/alpha).

If you intend to push this upstream then it would make sense to test
whether -latomic is needed for the actual types used in the source code.


: Index: patches/patch-configure_ac
: ===================================================================
: RCS file: /cvs/ports/audio/audacity/patches/patch-configure_ac,v
: retrieving revision 1.2
: diff -u -p -u -p -r1.2 patch-configure_ac
: --- patches/patch-configure_ac 27 Mar 2019 16:19:55 -0000 1.2
: +++ patches/patch-configure_ac 21 May 2019 12:44:52 -0000
: @@ -1,21 +1,35 @@
: $OpenBSD: patch-configure_ac,v 1.2 2019/03/27 16:19:55 jca Exp $
:
: -- do not use -latomic with clang
: +- check if -latomic is needed
: +- disable jack
:
: Index: configure.ac
: --- configure.ac.orig
: +++ configure.ac
: -@@ -208,9 +208,6 @@ dnl Check if $CXX is clang by evaluating the version s
: - dnl $ax_cv_cxx_compiler_vendor seems not to work (it is either "gnu" or just empty).
: - dnl If $CXX is clang (string is found), grep returns 0 and the if is executed.
: - dnl Use /dev/null to suppress grep output to shell.
: +@@ -204,12 +204,16 @@ if test x$enable_universal_binary = xyes; then
: + esac
: + fi
: +
: +-dnl Check if $CXX is clang by evaluating the version string because
: +-dnl $ax_cv_cxx_compiler_vendor seems not to work (it is either "gnu" or just empty).
: +-dnl If $CXX is clang (string is found), grep returns 0 and the if is executed.
: +-dnl Use /dev/null to suppress grep output to shell.
: -if ($CXX --version | grep 'clang version' > /dev/null); then
: - LDFLAGS="${LDFLAGS} -latomic"
: --fi
: ++AC_LINK_IFELSE([AC_LANG_SOURCE([[
: ++ #include <atomic>
: ++ #include <cstdint>
: ++ std::atomic<std::int64_t> v;
: ++ int main() {
: ++ return v;
: ++ }
: ++]])], STD_ATOMIC_NEED_LIBATOMIC=no, STD_ATOMIC_NEED_LIBATOMIC=yes)
: ++if test "x$STD_ATOMIC_NEED_LIBATOMIC" = xyes; then
: ++ LDFLAGS="${LDFLAGS} -latomic"
: + fi
:
: if test x$enable_sse = xyes; then
: -
: -@@ -650,10 +647,6 @@ case "${host_os}" in
: +@@ -650,10 +654,6 @@ case "${host_os}" in
: AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
: if [[ $have_alsa = "yes" ]] ; then
: LIBS="$LIBS -lasound"


--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE

No comments:

Post a Comment