• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/json-c/0002-Link-against-libm-when-needed.patch
Thomas PetazzoniThomas Petazzoni committed 4e99abc475101 May 2015
Raw file
Source viewDiff to previous
 
1
From ccb15ee3d7e8c925cb3af9ea805feea2863c4f81 Mon Sep 17 00:00:00 2001
2
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3
Date: Fri, 1 May 2015 12:52:18 +0200
4
Subject: [PATCH] Link against libm when needed
5
​
6
In certain C libraries (e.g uClibc), isnan() and related functions are
7
implemented in libm, so json-c needs to link against it. This commit
8
therefore adds an AC_TRY_LINK() test to check whether a program
9
calling isnan() can be properly linked with no special flags. If not,
10
we assume linking against libm is needed.
11
​
12
The json-c.pc.in file is also adjusted so that in the case of static
13
linking against json-c, -lm is also used.
14
​
15
Submitted upstream: https://github.com/json-c/json-c/pull/182
16
​
17
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
18
---
19
 configure.ac | 4 ++++
20
 json-c.pc.in | 3 ++-
21
 2 files changed, 6 insertions(+), 1 deletion(-)
22
​
23
diff --git a/configure.ac b/configure.ac
24
index 99660a4..2a14ccf 100644
25
--- a/configure.ac
26
+++ b/configure.ac
27
@@ -50,6 +50,10 @@ AC_CHECK_DECLS([isinf], [], [], [[#include <math.h>]])
28
 AC_CHECK_DECLS([_isnan], [], [], [[#include <float.h>]])
29
 AC_CHECK_DECLS([_finite], [], [], [[#include <float.h>]])
30
 
31
+if test "$ac_cv_have_decl_isnan" = "yes" ; then
32
+   AC_TRY_LINK([#include <math.h>], [float f = 0.0; return isnan(f)], [], [LIBS="$LIBS -lm"])
33
+fi
34
+
35
 #check if .section.gnu.warning accepts long strings (for __warn_references)
36
 AC_LANG_PUSH([C])
37
 
38
diff --git a/json-c.pc.in b/json-c.pc.in
39
index 037739d..05bfbc8 100644
40
--- a/json-c.pc.in
41
+++ b/json-c.pc.in
42
@@ -6,6 +6,7 @@ includedir=@includedir@
43
 Name: json-c
44
 Description: JSON implementation in C
45
 Version: @VERSION@
46
-Requires: 
47
+Requires:
48
+Libs.private: @LIBS@
49
 Libs:  -L${libdir} -ljson-c
50
 Cflags: -I${includedir}/json-c
51
-- 
52
2.1.0
53
​
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.