Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 507708 | Differences between
and this patch

Collapse All | Expand All

(-)/branches/2.1/configure.ac (-12 / +7 lines)
Lines 752-755 Link Here
752
CHECK_JSON=yes
752
CHECK_JSON=yes
753
HAVE_JSON=no
753
HAVE_JSON=no
754
HAVE_JSON_C=no
754
755
755
AC_ARG_WITH([json],
756
AC_ARG_WITH([json],
Lines 768-781 Link Here
768
		AC_MSG_ERROR([you must specify a parameter to --with-jsondir, e.g. --with-jsondir=/path/to])
769
		AC_MSG_ERROR([you must specify a parameter to --with-jsondir, e.g. --with-jsondir=/path/to])
769
	else
770
	else
770
		dnl We need (libjson.so OR libjson.a OR libjson.dll) AND json/json.h
771
		if test ! -e "${JSONDIR}/include/json/json.h" -o \
772
		        ! \( -e "${JSONDIR}/lib/libjson.so" -o \
773
		            -e "${JSONDIR}/lib/libjson.dll" -o \
774
		            -e "${JSONDIR}/lib/libjson.dylib" -o \
775
		            -e "${JSONDIR}/bin/libjson.dll" -o \
776
		            -e "${JSONDIR}/lib/libjson.a" \) 
777
		then
778
			AC_MSG_ERROR([Cannot find json dev files in "$JSONDIR"])
779
		fi
780
		AC_MSG_RESULT([Using user-specified json-c directory: $JSONDIR])
771
		AC_MSG_RESULT([Using user-specified json-c directory: $JSONDIR])
781
772
Lines 789-794 Link Here
789
CPPFLAGS_SAVE="$CPPFLAGS"
780
CPPFLAGS_SAVE="$CPPFLAGS"
790
CPPFLAGS="$JSON_CPPFLAGS"
781
CPPFLAGS="$JSON_CPPFLAGS"
791
AC_CHECK_HEADER([json-c/json.h], [HAVE_JSON=yes], [
782
AC_CHECK_HEADER([json/json.h], [HAVE_JSON=yes], [
792
  AC_CHECK_HEADER([json/json.h], [HAVE_JSON=yes], [])])	
783
  AC_CHECK_HEADER([json-c/json.h], [HAVE_JSON=yes; HAVE_JSON_C=yes], [])
784
])      
793
CPPFLAGS="$CPPFLAGS_SAVE"
785
CPPFLAGS="$CPPFLAGS_SAVE"
794
786
Lines 803-806 Link Here
803
if test "$HAVE_JSON" = "yes"; then
795
if test "$HAVE_JSON" = "yes"; then
804
	AC_DEFINE([HAVE_LIBJSON], 1, [Define to 1 if libjson is present])
796
	AC_DEFINE([HAVE_LIBJSON], 1, [Define to 1 if libjson is present])
797
fi
798
if test "$HAVE_JSON_C" = "yes"; then
799
  AC_DEFINE([HAVE_LIBJSON_C], 1, [Define to 1 if libjson resides in a json-c subdir])
805
fi
800
fi
806
801
(-)/branches/2.1/liblwgeom/lwin_geojson.c (-8 / +20 lines)
Lines 18-24 Link Here
18
#ifdef HAVE_LIBJSON
18
#ifdef HAVE_LIBJSON
19
19
20
#include <string.h>
21
22
#ifdef HAVE_LIBJSON_C
23
#include <json-c/json.h>
24
#include <json-c/json_object_private.h>
25
#else
20
#include <json/json.h>
26
#include <json/json.h>
21
#include <json/json_object_private.h>
27
#include <json/json_object_private.h>
22
#include <string.h>
28
#endif
29
30
#ifndef JSON_C_VERSION
31
// Adds support for libjson < 0.10
32
# define json_tokener_error_desc(x) json_tokener_errors[(x)]
33
#endif
34
23
35
24
static void geojson_lwerror(char *msg, int error_code)
36
static void geojson_lwerror(char *msg, int error_code)
Lines 503-507 Link Here
503
	json_object* poObj = NULL;
515
	json_object* poObj = NULL;
504
	json_object* poObjSrs = NULL;
516
	json_object* poObjSrs = NULL;
505
  *srs = NULL;
517
	*srs = NULL;
506
518
507
	/* Begin to Parse json */
519
	/* Begin to Parse json */
Lines 511-519 Link Here
511
	{
523
	{
512
		char err[256];
524
		char err[256];
513
		snprintf(err, 256, "%s (at offset %d)", json_tokener_errors[jstok->err], jstok->char_offset);
525
		snprintf(err, 256, "%s (at offset %d)", json_tokener_error_desc(jstok->err), jstok->char_offset);
514
		json_tokener_free(jstok);
526
		json_tokener_free(jstok);
515
    json_object_put(poObj);
527
		json_object_put(poObj);
516
		geojson_lwerror(err, 1);
528
		geojson_lwerror(err, 1);
517
    return NULL;
529
		return NULL;
518
	}
530
	}
519
	json_tokener_free(jstok);
531
	json_tokener_free(jstok);
Lines 528-538 Link Here
528
			json_object* poNameURL = findMemberByName( poObjSrsProps, "name" );
540
			json_object* poNameURL = findMemberByName( poObjSrsProps, "name" );
529
			const char* pszName = json_object_get_string( poNameURL );
541
			const char* pszName = json_object_get_string( poNameURL );
530
      *srs = lwalloc(strlen(pszName) + 1);
542
			*srs = lwalloc(strlen(pszName) + 1);
531
      strcpy(*srs, pszName);
543
			strcpy(*srs, pszName);
532
		}
544
		}
533
	}
545
	}
534
546
535
	lwgeom = parse_geojson(poObj, &hasz, 0);
547
	lwgeom = parse_geojson(poObj, &hasz, 0);
536
  json_object_put(poObj);
548
	json_object_put(poObj);
537
549
538
	lwgeom_add_bbox(lwgeom);
550
	lwgeom_add_bbox(lwgeom);
(-)/branches/2.1/postgis_config.h.in (+3 lines)
Lines 54-57 Link Here
54
/* Define to 1 if libjson is present */
54
/* Define to 1 if libjson is present */
55
#undef HAVE_LIBJSON
55
#undef HAVE_LIBJSON
56
57
/* Define to 1 if libjson resides in json-c subdir */
58
#undef HAVE_LIBJSON_C
56
59
57
/* Define to 1 if you have the `pq' library (-lpq). */
60
/* Define to 1 if you have the `pq' library (-lpq). */

Return to bug 507708