0001-fix-jsoncpp-detection.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. From 25762953c019ca0c5a047a5fa28f1fe6c78c731a Mon Sep 17 00:00:00 2001
  2. From: Jean-Francois Dockes <jf@dockes.org>
  3. Date: Sun, 11 Sep 2016 13:43:28 +0200
  4. Subject: [PATCH] fix jsoncpp detection
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. The default installation path for the header files is {prefix}/json, but some
  9. system prefers to install the headers in {prefix}/jsoncpp/json.
  10. This patch from upstream handles both cases now when checking for the jsoncpp
  11. library.
  12. The patch is squashed of two commits from upstream:
  13. 1/ aba96db0cfe8a2e5c825f4448c0ad184e21b50e1
  14. 2/ ce144f19a8c2e8c1e0ec3fe53699e874e5eb43fe
  15. Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
  16. ---
  17. configure.ac | 8 +++++++-
  18. src/config.h.in | 6 ++++++
  19. src/mediaserver/cdplugins/plgwithslave.cxx | 5 +++++
  20. 3 files changed, 18 insertions(+), 1 deletion(-)
  21. diff --git a/configure.ac b/configure.ac
  22. index f191ad7..108dcce 100644
  23. --- a/configure.ac
  24. +++ b/configure.ac
  25. @@ -43,9 +43,15 @@ SCCTL_LIBS=$LIBS
  26. AC_CHECK_LIB([microhttpd], [MHD_queue_response], [], [])
  27. AC_LANG_PUSH([C++])
  28. +
  29. +AC_CHECK_HEADERS(json/json.h jsoncpp/json/json.h)
  30. LIBS="$LIBS -ljsoncpp"
  31. AC_LINK_IFELSE([AC_LANG_PROGRAM(
  32. - [#include <jsoncpp/json/json.h>], [Json::Features dummy])],
  33. + [[#ifdef HAVE_JSONCPP_JSON_JSON_H
  34. + #include <jsoncpp/json/json.h>
  35. + #else
  36. + #include <json/json.h>
  37. + #endif]], [Json::Features dummy])],
  38. [HAVE_JSONCPP=1],
  39. [AC_MSG_ERROR([libjsoncpp not found.])])
  40. AC_LANG_POP
  41. diff --git a/src/config.h.in b/src/config.h.in
  42. index 1350308..0a33e15 100644
  43. --- a/src/config.h.in
  44. +++ b/src/config.h.in
  45. @@ -3,6 +3,12 @@
  46. /* Define to 1 if you have the <inttypes.h> header file. */
  47. #undef HAVE_INTTYPES_H
  48. +/* Define to 1 if you have the <jsoncpp/json/json.h> header file. */
  49. +#undef HAVE_JSONCPP_JSON_JSON_H
  50. +
  51. +/* Define to 1 if you have the <json/json.h> header file. */
  52. +#undef HAVE_JSON_JSON_H
  53. +
  54. /* Define to 1 if you have the `microhttpd' library (-lmicrohttpd). */
  55. #undef HAVE_LIBMICROHTTPD
  56. diff --git a/src/mediaserver/cdplugins/plgwithslave.cxx b/src/mediaserver/cdplugins/plgwithslave.cxx
  57. index 04f0544..545805c 100644
  58. --- a/src/mediaserver/cdplugins/plgwithslave.cxx
  59. +++ b/src/mediaserver/cdplugins/plgwithslave.cxx
  60. @@ -14,6 +14,7 @@
  61. * Free Software Foundation, Inc.,
  62. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  63. */
  64. +#include "config.h"
  65. #include "plgwithslave.hxx"
  66. @@ -25,7 +26,11 @@
  67. #include <string.h>
  68. #include <upnp/upnp.h>
  69. #include <microhttpd.h>
  70. +#ifdef HAVE_JSONCPP_JSON_JSON_H
  71. #include <jsoncpp/json/json.h>
  72. +#else
  73. +#include <json/json.h>
  74. +#endif
  75. #include "cmdtalk.h"
  76. #include "pathut.h"
  77. --
  78. 2.9.3