postgis-2.1.4-pkgconfig-json.patch 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. diff --git a/configure.ac b/configure.ac
  2. index a13cf13..c0a7842 100644
  3. --- a/configure.ac
  4. +++ b/configure.ac
  5. @@ -780,61 +780,19 @@ dnl ===========================================================================
  6. dnl Detect if json-c installed
  7. dnl ===========================================================================
  8. -CHECK_JSON=yes
  9. -HAVE_JSON=no
  10. -HAVE_JSON_C=no
  11. -
  12. -AC_ARG_WITH([json],
  13. - [AS_HELP_STRING([--without-json], [build without json-c support])],
  14. - [CHECK_JSON="$withval"], [])
  15. -
  16. -if test "$CHECK_JSON" != "no"; then dnl {
  17. -
  18. -AC_ARG_WITH([jsondir],
  19. - [AS_HELP_STRING([--with-jsondir=PATH], [specify the json-c installation directory])],
  20. - [JSONDIR="$withval"], [JSONDIR=])
  21. -
  22. -if test ! "x$JSONDIR" = "x"; then
  23. - dnl Make sure that the directory exists
  24. - if test "x$JSONDIR" = "xyes"; then
  25. - AC_MSG_ERROR([you must specify a parameter to --with-jsondir, e.g. --with-jsondir=/path/to])
  26. - else
  27. - AC_MSG_RESULT([Using user-specified json-c directory: $JSONDIR])
  28. -
  29. - dnl Add the include directory to JSON_CPPFLAGS
  30. - JSON_CPPFLAGS="-I$JSONDIR/include"
  31. - JSON_LDFLAGS="-L$JSONDIR/lib"
  32. - fi
  33. -fi
  34. -
  35. -dnl Check that we can find the json/json.h header file
  36. -CPPFLAGS_SAVE="$CPPFLAGS"
  37. -CPPFLAGS="$JSON_CPPFLAGS"
  38. -AC_CHECK_HEADER([json/json.h], [HAVE_JSON=yes], [
  39. - AC_CHECK_HEADER([json-c/json.h], [HAVE_JSON=yes; HAVE_JSON_C=yes], [])
  40. -])
  41. -CPPFLAGS="$CPPFLAGS_SAVE"
  42. -
  43. -dnl Ensure we can link against libjson
  44. -LIBS_SAVE="$LIBS"
  45. -LIBS="$JSON_LDFLAGS"
  46. -AC_CHECK_LIB([json-c], [json_object_get], [HAVE_JSON=yes; JSON_LDFLAGS="${JSON_LDFLAGS} -ljson-c"], [
  47. - AC_CHECK_LIB([json], [json_object_get], [HAVE_JSON=yes; JSON_LDFLAGS="${JSON_LDFLAGS} -ljson"], [], [])
  48. -], [])
  49. -LIBS="$LIBS_SAVE"
  50. -
  51. -if test "$HAVE_JSON" = "yes"; then
  52. +PKG_CHECK_MODULES([JSON], [json],
  53. + [
  54. + HAVE_JSON=yes
  55. AC_DEFINE([HAVE_LIBJSON], 1, [Define to 1 if libjson is present])
  56. -fi
  57. -if test "$HAVE_JSON_C" = "yes"; then
  58. - AC_DEFINE([HAVE_LIBJSON_C], 1, [Define to 1 if libjson resides in a json-c subdir])
  59. -fi
  60. -
  61. -AC_SUBST([JSON_CPPFLAGS])
  62. -AC_SUBST([JSON_LDFLAGS])
  63. -AC_SUBST([HAVE_JSON])
  64. -
  65. -fi dnl }
  66. + ],
  67. + [
  68. + PKG_CHECK_MODULES([JSON], [json-c],
  69. + [
  70. + HAVE_JSON=yes
  71. + AC_DEFINE([HAVE_LIBJSON], 1, [Define to 1 if libjson is present])
  72. + ],
  73. + [HAVE_JSON=no])
  74. + ])
  75. dnl ===========================================================================
  76. dnl Detect GTK+2.0 for GUI
  77. @@ -927,7 +885,7 @@ AC_DEFINE_UNQUOTED([POSTGIS_USE_STATS], [1], [Enable use of ANALYZE statistics])
  78. CPPFLAGS="$PGSQL_CPPFLAGS $GEOS_CPPFLAGS $PROJ_CPPFLAGS $XML2_CPPFLAGS $SFCGAL_CPPFLAGS $CPPFLAGS"
  79. AC_MSG_RESULT([CPPFLAGS: $CPPFLAGS])
  80. -SHLIB_LINK="$PGSQL_LDFLAGS $GEOS_LDFLAGS $PROJ_LDFLAGS -lgeos_c -lproj $JSON_LDFLAGS $XML2_LDFLAGS $SFCGAL_LDFLAGS"
  81. +SHLIB_LINK="$PGSQL_LDFLAGS $GEOS_LDFLAGS $PROJ_LDFLAGS -lgeos_c -lproj $JSON_LIBS $XML2_LDFLAGS $SFCGAL_LDFLAGS"
  82. AC_SUBST([SHLIB_LINK])
  83. dnl AC_MSG_RESULT([SHLIB_LINK: $SHLIB_LINK])
  84. diff --git a/liblwgeom/Makefile.in b/liblwgeom/Makefile.in
  85. index 3cc6256..5ccbb3b 100644
  86. --- a/liblwgeom/Makefile.in
  87. +++ b/liblwgeom/Makefile.in
  88. @@ -11,8 +11,8 @@
  89. # **********************************************************************
  90. CC = @CC@
  91. -CFLAGS = @CFLAGS@ @PICFLAGS@ @WARNFLAGS@ @GEOS_CPPFLAGS@ @PROJ_CPPFLAGS@ @JSON_CPPFLAGS@
  92. -LDFLAGS = @LDFLAGS@ @GEOS_LDFLAGS@ -lgeos_c @PROJ_LDFLAGS@ -lproj @JSON_LDFLAGS@
  93. +CFLAGS = @CFLAGS@ @PICFLAGS@ @WARNFLAGS@ @GEOS_CPPFLAGS@ @PROJ_CPPFLAGS@ @JSON_CFLAGS@
  94. +LDFLAGS = @LDFLAGS@ @GEOS_LDFLAGS@ -lgeos_c @PROJ_LDFLAGS@ -lproj @JSON_LIBS@
  95. NUMERICFLAGS = @NUMERICFLAGS@
  96. top_builddir = @top_builddir@
  97. prefix = @prefix@
  98. diff --git a/liblwgeom/lwin_geojson.c b/liblwgeom/lwin_geojson.c
  99. index 7019626..ec1d594 100644
  100. --- a/liblwgeom/lwin_geojson.c
  101. +++ b/liblwgeom/lwin_geojson.c
  102. @@ -19,13 +19,8 @@
  103. #include <string.h>
  104. -#ifdef HAVE_LIBJSON_C
  105. -#include <json-c/json.h>
  106. -#include <json-c/json_object_private.h>
  107. -#else
  108. -#include <json/json.h>
  109. -#include <json/json_object_private.h>
  110. -#endif
  111. +#include <json.h>
  112. +#include <json_object_private.h>
  113. #ifndef JSON_C_VERSION
  114. // Adds support for libjson < 0.10