X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=cirros-testvm%2Fsrc-cirros%2Fbuildroot-2015.05%2Fpackage%2Fjson-c%2F0002-Link-against-libm-when-needed.patch;fp=cirros-testvm%2Fsrc-cirros%2Fbuildroot-2015.05%2Fpackage%2Fjson-c%2F0002-Link-against-libm-when-needed.patch;h=305b782f76c4101957f965a498648939d5a6b30f;hb=b0a0f15dfaa205161a7fcb20cf1b8cd4948c2ef3;hp=0000000000000000000000000000000000000000;hpb=c6ac3cd55ee2da956195eee393b0882105dfad4e;p=packages%2Ftrusty%2Fcirros-testvm.git diff --git a/cirros-testvm/src-cirros/buildroot-2015.05/package/json-c/0002-Link-against-libm-when-needed.patch b/cirros-testvm/src-cirros/buildroot-2015.05/package/json-c/0002-Link-against-libm-when-needed.patch new file mode 100644 index 0000000..305b782 --- /dev/null +++ b/cirros-testvm/src-cirros/buildroot-2015.05/package/json-c/0002-Link-against-libm-when-needed.patch @@ -0,0 +1,53 @@ +From ccb15ee3d7e8c925cb3af9ea805feea2863c4f81 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Fri, 1 May 2015 12:52:18 +0200 +Subject: [PATCH] Link against libm when needed + +In certain C libraries (e.g uClibc), isnan() and related functions are +implemented in libm, so json-c needs to link against it. This commit +therefore adds an AC_TRY_LINK() test to check whether a program +calling isnan() can be properly linked with no special flags. If not, +we assume linking against libm is needed. + +The json-c.pc.in file is also adjusted so that in the case of static +linking against json-c, -lm is also used. + +Submitted upstream: https://github.com/json-c/json-c/pull/182 + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 4 ++++ + json-c.pc.in | 3 ++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 99660a4..2a14ccf 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -50,6 +50,10 @@ AC_CHECK_DECLS([isinf], [], [], [[#include ]]) + AC_CHECK_DECLS([_isnan], [], [], [[#include ]]) + AC_CHECK_DECLS([_finite], [], [], [[#include ]]) + ++if test "$ac_cv_have_decl_isnan" = "yes" ; then ++ AC_TRY_LINK([#include ], [float f = 0.0; return isnan(f)], [], [LIBS="$LIBS -lm"]) ++fi ++ + #check if .section.gnu.warning accepts long strings (for __warn_references) + AC_LANG_PUSH([C]) + +diff --git a/json-c.pc.in b/json-c.pc.in +index 037739d..05bfbc8 100644 +--- a/json-c.pc.in ++++ b/json-c.pc.in +@@ -6,6 +6,7 @@ includedir=@includedir@ + Name: json-c + Description: JSON implementation in C + Version: @VERSION@ +-Requires: ++Requires: ++Libs.private: @LIBS@ + Libs: -L${libdir} -ljson-c + Cflags: -I${includedir}/json-c +-- +2.1.0 +