]> granicus.if.org Git - postgis/commitdiff
Try to make json-c detection slightly more automatic.
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 4 Jan 2012 02:07:12 +0000 (02:07 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 4 Jan 2012 02:07:12 +0000 (02:07 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8668 b70326c6-7e19-0410-871a-916f4a2858ee

configure.ac

index 5220c1166f6417a879e53a1ad6cad5269befe8a8..aada5be96dceac77a49906751c8a42103ce4c4fb 100644 (file)
@@ -639,31 +639,30 @@ if test ! "x$JSONDIR" = "x"; then
                        dnl Add the include directory to JSON_CPPFLAGS
                        JSON_CPPFLAGS="-I$JSONDIR/include"
                        JSON_LDFLAGS="-L$JSONDIR/lib -ljson"
-
-                       dnl Check that we can find the json/json.h header file
-                       CPPFLAGS_SAVE="$CPPFLAGS"
-                       CPPFLAGS="$JSON_CPPFLAGS"
-                       AC_CHECK_HEADER([json/json.h], [], [AC_MSG_ERROR([could not find json/json.h - you may need to specify the directory of a json-c installation using --with-jsondir])])  
-                       CPPFLAGS="$CPPFLAGS_SAVE"
-
-                       dnl Ensure we can link against libjson
-                       LIBS_SAVE="$LIBS"
-                       LIBS="$JSON_LDFLAGS"
-                       AC_CHECK_LIB([json], [json_object_get],
-                               [],
-                               [AC_MSG_ERROR([could not find libjson - you may need to specify the directory of a json-c installation using --with-jsondir])],
-                               [])
-                       LIBS="$LIBS_SAVE"
-                       HAVE_JSON=Yes
                else
                        AC_MSG_ERROR([the --with-jsondir directory "$JSONDIR" cannot be found])
                fi
        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], [json_object_get], [HAVE_JSON=Yes], [], [])
+LIBS="$LIBS_SAVE"
+
+if test "$HAVE_JSON" = "Yes"; then
+  AC_DEFINE([HAVE_LIBJSON],1)
+fi
+
 AC_SUBST([JSON_CPPFLAGS])
 AC_SUBST([JSON_LDFLAGS])
-AC_SUBST([HAVE_JSON])
 
 dnl ===========================================================================
 dnl Detect GTK+2.0 for GUI