0004-Use-pkg-config-for-jsoncpp-libmpdclient-libmicrohttpd.patch 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. From 5091e1afd9d0a69bdf10d12d4a66f7147e8185a3 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
  3. Date: Fri, 23 Sep 2016 21:37:36 +0200
  4. Subject: [PATCH] Use pkg-config for jsoncpp, libmpdclient and libmicrohttpd
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. libmpdclient, libmicrohttpd and jsoncpp provide a .pc file. Use
  9. pkg-config for detecting the libraries and for providing the necessary
  10. details for compiling and linking.
  11. The current build system of upmpdcli does not use PKG_CHECK_MODULES, but
  12. AC_LINK_IFELSE to detect jsoncpp. After bumping jsoncpp version from 1.7.2 to
  13. 1.7.5 the detection fails, because the test program does not compile:
  14. '''
  15. In file included from /usr/arm-buildroot-linux-gnueabi/sysroot/usr/include/json/autolink.h:9:0,
  16. from /usr/arm-buildroot-linux-gnueabi/sysroot/usr/include/json/json.h:9,
  17. from test.c:1:
  18. /usr/arm-buildroot-linux-gnueabi/sysroot/usr/include/json/config.h:155:9: error: 'int64_t' does not name a type
  19. typedef int64_t Int64;
  20. ^
  21. /usr/arm-buildroot-linux-gnueabi/sysroot/usr/include/json/config.h:156:9: error: 'uint64_t' does not name a type
  22. typedef uint64_t UInt64;
  23. ^
  24. /usr/arm-buildroot-linux-gnueabi/sysroot/usr/include/json/config.h:158:9: error: 'Int64' does not name a type
  25. typedef Int64 LargestInt;
  26. ^
  27. /usr/arm-buildroot-linux-gnueabi/sysroot/usr/include/json/config.h:159:9: error: 'UInt64' does not name a type
  28. typedef UInt64 LargestUInt;
  29. ^
  30. In file included from /usr/arm-buildroot-linux-gnueabi/sysroot/usr/include/json/json.h:10:0,
  31. from test.c:1:
  32. /usr/arm-buildroot-linux-gnueabi/sysroot/usr/include/json/value.h:184:11: error: 'UInt64' in namespace 'Json' does not name a type
  33. typedef Json::UInt64 UInt64;
  34. [..]
  35. '''
  36. Instead of fixing the test program use PKG_CHECK_MODULES to check for
  37. jsoncpp. While we're on it, add it for libmpdclient and libmicrohttpd, too.
  38. Upstream-status: https://github.com/medoc92/upmpdcli/pull/52
  39. Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
  40. ---
  41. Makefile.am | 3 ++-
  42. configure.ac | 24 +++++++-----------------
  43. 2 files changed, 9 insertions(+), 18 deletions(-)
  44. diff --git a/Makefile.am b/Makefile.am
  45. index 5c83aa1..6f6e018 100644
  46. --- a/Makefile.am
  47. +++ b/Makefile.am
  48. @@ -1,5 +1,6 @@
  49. AM_CPPFLAGS = -DDEBUG -g -Wall \
  50. - $(upnpp_CFLAGS) \
  51. + $(upnpp_CFLAGS) $(libmpdclient_CFLAGS) $(libmicrohttpd_CFLAGS) \
  52. + $(jsoncpp_CFLAGS) \
  53. -I$(top_srcdir)/src \
  54. -DDATADIR=\"${pkgdatadir}\" -DCONFIGDIR=\"${sysconfdir}\"
  55. diff --git a/configure.ac b/configure.ac
  56. index a165b5d..0ef0f3b 100644
  57. --- a/configure.ac
  58. +++ b/configure.ac
  59. @@ -36,27 +36,17 @@ dnl AC_CHECK_LIB([curl], [curl_easy_init], [],AC_MSG_ERROR([libcurl not found]))
  60. dnl AC_CHECK_LIB([expat], [XML_ParserCreate], [],AC_MSG_ERROR([libexpat not found]))
  61. PKG_CHECK_MODULES([upnpp], [libupnpp], [], [AC_MSG_ERROR([libupnpp])])
  62. -AC_CHECK_LIB([mpdclient], [mpd_connection_new], [],
  63. - AC_MSG_ERROR([libmpdclient not found]))
  64. -SCCTL_LIBS="$LIBS $upnpp_LIBS"
  65. +PKG_CHECK_MODULES([libmpdclient], [libmpdclient], [],
  66. + [AC_MSG_ERROR([libmpdclient not found])])
  67. +SCCTL_LIBS="$LIBS $upnpp_LIBS $libmpdclient_LIBS"
  68. -AC_CHECK_LIB([microhttpd], [MHD_queue_response], [], [])
  69. -
  70. -AC_LANG_PUSH([C++])
  71. +PKG_CHECK_MODULES([libmicrohttpd], [libmicrohttpd], [],
  72. + [AC_MSG_ERROR([libmicrohttpd not found])])
  73. AC_CHECK_HEADERS(json/json.h jsoncpp/json/json.h)
  74. -LIBS="$LIBS -ljsoncpp"
  75. -AC_LINK_IFELSE([AC_LANG_PROGRAM(
  76. - [[#ifdef HAVE_JSONCPP_JSON_JSON_H
  77. - #include <jsoncpp/json/json.h>
  78. - #else
  79. - #include <json/json.h>
  80. - #endif]], [Json::Features dummy])],
  81. - [HAVE_JSONCPP=1],
  82. - [AC_MSG_ERROR([libjsoncpp not found.])])
  83. -AC_LANG_POP
  84. +PKG_CHECK_MODULES([jsoncpp], [jsoncpp], [], [AC_MSG_ERROR([jsoncpp not found])])
  85. -UPMPDCLI_LIBS="$LIBS $upnpp_LIBS"
  86. +UPMPDCLI_LIBS="$LIBS $upnpp_LIBS $libmpdclient_LIBS $libmicrohttpd_LIBS $jsoncpp_LIBS"
  87. echo "UPMPDCLI_LIBS=$UPMPDCLI_LIBS"
  88. LIBS=""
  89. --
  90. 2.10.0