postgis-2.1-pkgconfig-json.patch 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. diff -Naruw postgis-2.1.0.orig/configure.ac postgis-2.1.0/configure.ac
  2. --- postgis-2.1.0.orig/configure.ac 2013-07-09 03:36:15.000000000 +0000
  3. +++ postgis-2.1.0/configure.ac 2013-08-18 18:14:23.263697970 +0000
  4. @@ -745,65 +745,21 @@
  5. dnl Detect if json-c installed
  6. dnl ===========================================================================
  7. -CHECK_JSON=yes
  8. -HAVE_JSON=no
  9. -AC_SUBST([HAVE_JSON])
  10. -
  11. -AC_ARG_WITH([json],
  12. - [AS_HELP_STRING([--without-json], [build without json-c support])],
  13. - [CHECK_JSON="$withval"], [])
  14. -
  15. -if test "$CHECK_JSON" != "no"; then dnl {
  16. -
  17. -AC_ARG_WITH([jsondir],
  18. - [AS_HELP_STRING([--with-jsondir=PATH], [specify the json-c installation directory])],
  19. - [JSONDIR="$withval"], [JSONDIR=])
  20. -
  21. -if test ! "x$JSONDIR" = "x"; then
  22. - dnl Make sure that the directory exists
  23. - if test "x$JSONDIR" = "xyes"; then
  24. - AC_MSG_ERROR([you must specify a parameter to --with-jsondir, e.g. --with-jsondir=/path/to])
  25. - else
  26. - dnl We need (libjson.so OR libjson.a OR libjson.dll) AND json/json.h
  27. - if test ! -e "${JSONDIR}/include/json/json.h" -o \
  28. - ! \( -e "${JSONDIR}/lib/libjson.so" -o \
  29. - -e "${JSONDIR}/lib/libjson.dll" -o \
  30. - -e "${JSONDIR}/lib/libjson.dylib" -o \
  31. - -e "${JSONDIR}/bin/libjson.dll" -o \
  32. - -e "${JSONDIR}/lib/libjson.a" \)
  33. - then
  34. - AC_MSG_ERROR([Cannot find json dev files in "$JSONDIR"])
  35. - fi
  36. - AC_MSG_RESULT([Using user-specified json-c directory: $JSONDIR])
  37. -
  38. - dnl Add the include directory to JSON_CPPFLAGS
  39. - JSON_CPPFLAGS="-I$JSONDIR/include"
  40. - JSON_LDFLAGS="-L$JSONDIR/lib"
  41. - fi
  42. -fi
  43. -
  44. -dnl Check that we can find the json/json.h header file
  45. -CPPFLAGS_SAVE="$CPPFLAGS"
  46. -CPPFLAGS="$JSON_CPPFLAGS"
  47. -AC_CHECK_HEADER([json/json.h], [HAVE_JSON=yes], [])
  48. -CPPFLAGS="$CPPFLAGS_SAVE"
  49. -
  50. -dnl Ensure we can link against libjson
  51. -LIBS_SAVE="$LIBS"
  52. -LIBS="$JSON_LDFLAGS"
  53. -AC_CHECK_LIB([json-c], [json_object_get], [HAVE_JSON=yes; JSON_LDFLAGS="${JSON_LDFLAGS} -ljson-c"], [
  54. - AC_CHECK_LIB([json], [json_object_get], [HAVE_JSON=yes; JSON_LDFLAGS="${JSON_LDFLAGS} -ljson"], [], [])
  55. -], [])
  56. -LIBS="$LIBS_SAVE"
  57. -
  58. -if test "$HAVE_JSON" = "yes"; then
  59. +PKG_CHECK_MODULES([JSON], [json],
  60. + [
  61. + HAVE_JSON=yes
  62. AC_DEFINE([HAVE_LIBJSON], 1, [Define to 1 if libjson is present])
  63. -fi
  64. -
  65. -AC_SUBST([JSON_CPPFLAGS])
  66. -AC_SUBST([JSON_LDFLAGS])
  67. + ],
  68. + [
  69. + PKG_CHECK_MODULES([JSON], [json-c],
  70. + [
  71. + HAVE_JSON=yes
  72. + AC_DEFINE([HAVE_LIBJSON], 1, [Define to 1 if libjson is present])
  73. + ],
  74. + [HAVE_JSON=no])
  75. + ])
  76. -fi dnl }
  77. +AC_SUBST([HAVE_JSON])
  78. dnl ===========================================================================
  79. dnl Detect GTK+2.0 for GUI
  80. @@ -896,7 +852,7 @@
  81. CPPFLAGS="$PGSQL_CPPFLAGS $GEOS_CPPFLAGS $PROJ_CPPFLAGS $XML2_CPPFLAGS $SFCGAL_CPPFLAGS $CPPFLAGS"
  82. AC_MSG_RESULT([CPPFLAGS: $CPPFLAGS])
  83. -SHLIB_LINK="$PGSQL_LDFLAGS $GEOS_LDFLAGS $PROJ_LDFLAGS -lgeos_c -lproj $JSON_LDFLAGS $XML2_LDFLAGS $SFCGAL_LDFLAGS"
  84. +SHLIB_LINK="$PGSQL_LDFLAGS $GEOS_LDFLAGS $PROJ_LDFLAGS -lgeos_c -lproj $JSON_LIBS $XML2_LDFLAGS $SFCGAL_LDFLAGS"
  85. AC_SUBST([SHLIB_LINK])
  86. dnl AC_MSG_RESULT([SHLIB_LINK: $SHLIB_LINK])
  87. diff -Naruw postgis-2.1.0.orig/liblwgeom/lwin_geojson.c postgis-2.1.0/liblwgeom/lwin_geojson.c
  88. --- postgis-2.1.0.orig/liblwgeom/lwin_geojson.c 2013-02-28 17:42:49.000000000 +0000
  89. +++ postgis-2.1.0/liblwgeom/lwin_geojson.c 2013-08-18 18:11:52.473943571 +0000
  90. @@ -17,8 +17,8 @@
  91. #ifdef HAVE_LIBJSON
  92. -#include <json/json.h>
  93. -#include <json/json_object_private.h>
  94. +#include <json.h>
  95. +#include <json_object_private.h>
  96. #include <string.h>
  97. static void geojson_lwerror(char *msg, int error_code)
  98. @@ -551,5 +551,3 @@
  99. return lwgeom;
  100. #endif /* HAVE_LIBJSON */
  101. }
  102. -
  103. -
  104. diff -Naruw postgis-2.1.0.orig/liblwgeom/Makefile.in postgis-2.1.0/liblwgeom/Makefile.in
  105. --- postgis-2.1.0.orig/liblwgeom/Makefile.in 2013-05-09 19:38:17.000000000 +0000
  106. +++ postgis-2.1.0/liblwgeom/Makefile.in 2013-08-18 18:11:52.477943594 +0000
  107. @@ -11,8 +11,8 @@
  108. # **********************************************************************
  109. CC = @CC@
  110. -CFLAGS = @CFLAGS@ @PICFLAGS@ @WARNFLAGS@ @GEOS_CPPFLAGS@ @PROJ_CPPFLAGS@ @JSON_CPPFLAGS@
  111. -LDFLAGS = @LDFLAGS@ @GEOS_LDFLAGS@ -lgeos_c @PROJ_LDFLAGS@ -lproj @JSON_LDFLAGS@
  112. +CFLAGS = @CFLAGS@ @PICFLAGS@ @WARNFLAGS@ @GEOS_CPPFLAGS@ @PROJ_CPPFLAGS@ @JSON_CFLAGS@
  113. +LDFLAGS = @LDFLAGS@ @GEOS_LDFLAGS@ -lgeos_c @PROJ_LDFLAGS@ -lproj @JSON_LIBS@
  114. NUMERICFLAGS = @NUMERICFLAGS@
  115. top_builddir = @top_builddir@
  116. prefix = @prefix@