All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [git commit] zeromq: check if -latomic is needed
Date: Tue, 8 May 2018 15:00:06 +0200	[thread overview]
Message-ID: <20180508125958.EA5878B896@busybox.osuosl.org> (raw)

commit: https://git.buildroot.net/buildroot/commit/?id=bc78182309b90bde2b96fc3296c5b24825520f26
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Fixes:
http://autobuild.buildroot.net/results/b149aa2ee00e4d6a53c884cf99ecb2dd8af58b65/
http://autobuild.buildroot.net/results/e4b3616ac2695d3b6898185a70da6509b1faa2b8/

Patch the package to check if -latomic is needed to be added, depending on the
result of AC_LINK_IFELSE.

The patch was sent to upstream, see:
https://github.com/zeromq/libzmq/pull/3083

Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 ...2-acinclude.m4-check-if-latomic-is-needed.patch | 70 ++++++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/package/zeromq/0002-acinclude.m4-check-if-latomic-is-needed.patch b/package/zeromq/0002-acinclude.m4-check-if-latomic-is-needed.patch
new file mode 100644
index 0000000000..a0c188a5c3
--- /dev/null
+++ b/package/zeromq/0002-acinclude.m4-check-if-latomic-is-needed.patch
@@ -0,0 +1,70 @@
+From 9f4ca582555b208d065f730b5ce3b1901136b275 Mon Sep 17 00:00:00 2001
+From: Asaf Kahlon <asafka7@gmail.com>
+Date: Mon, 7 May 2018 23:19:09 +0300
+Subject: [PATCH] acinclude.m4: check if -latomic is needed
+
+On some cases, -latomic is needed for linking, and since the current
+acinclude.m4 checks only compilation we can sometimes miss the need for -latomic
+and the linking process will fail.
+Therefore, the AC_CHECK_IFELSE was replaced with AC_LINK_IFELSE. If the first
+try fails, we try to link again with -latomic and add LIBS="-latomic" in case we
+succeeded.
+
+Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
+---
+ acinclude.m4 | 32 ++++++++++++++++++++++++++++----
+ 1 file changed, 28 insertions(+), 4 deletions(-)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index f648ed0f..aa35195f 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -668,7 +668,7 @@ dnl # Check if compiler supoorts __atomic_Xxx intrinsics
+ dnl ################################################################################
+ AC_DEFUN([LIBZMQ_CHECK_ATOMIC_INTRINSICS], [{
+     AC_MSG_CHECKING(whether compiler supports __atomic_Xxx intrinsics)
+-    AC_COMPILE_IFELSE([AC_LANG_SOURCE([
++    AC_LINK_IFELSE([AC_LANG_SOURCE([
+ /* atomic intrinsics test */
+ int v = 0;
+ int main (int, char **)
+@@ -677,9 +677,33 @@ int main (int, char **)
+     return t;
+ }
+     ])],
+-    [AC_MSG_RESULT(yes) ; libzmq_cv_has_atomic_instrisics="yes" ; $1],
+-    [AC_MSG_RESULT(no)  ; libzmq_cv_has_atomic_instrisics="no"  ; $2]
+-    )
++    [libzmq_cv_has_atomic_instrisics="yes"],
++    [libzmq_cv_has_atomic_instrisics="no"])
++
++    if test "x$libzmq_cv_has_atomic_instrisics" = "xno"; then
++        save_LDFLAGS=$LDFLAGS
++        LDFLAGS="$LDFLAGS -latomic"
++        AC_LINK_IFELSE([AC_LANG_SOURCE([
++        /* atomic intrinsics test */
++        int v = 0;
++        int main (int, char **)
++        {
++            int t = __atomic_add_fetch (&v, 1, __ATOMIC_ACQ_REL);
++            return t;
++        }
++        ])],
++        [libzmq_cv_has_atomic_instrisics="yes" LIBS="-latomic"],
++        [libzmq_cv_has_atomic_instrisics="no"])
++        LDFLAGS=$save_LDFLAGS
++    fi
++
++    if test "x$libzmq_cv_has_atomic_instrisics" = "xyes"; then
++        AC_MSG_RESULT(yes)
++        $1
++    else
++        AC_MSG_RESULT(no)
++        $2
++    fi
+ }])
+ 
+ dnl ################################################################################
+-- 
+2.17.0
+

                 reply	other threads:[~2018-05-08 13:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180508125958.EA5878B896@busybox.osuosl.org \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.