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