From f473ed548436935ec56fbe6d4fa49037c12bce1d Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Fri, 19 Apr 2013 15:09:11 +0200 Subject: [PATCH] Make libjson optional. --- .gitignore | 6 ++++-- Makefile.am | 7 ++++++- configure.ac | 12 ++++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 0e67d96..c73b9c3 100644 --- a/.gitignore +++ b/.gitignore @@ -82,13 +82,15 @@ ykpers-*.tar.gz ykpers-*.tar.gz.sig ykpers-1.pc ykpers-args.o +ykpers-json.lo +ykpers-json.o +ykpers-nojson.lo +ykpers-nojson.o ykpers-version.h ykpers-version.lo ykpers-version.o ykpers.lo ykpers.o -ykpers-json.lo -ykpers-json.o ykpers_lcl.lo ykpers_lcl.o ykpersonalize diff --git a/Makefile.am b/Makefile.am index 0178fbb..7215717 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,7 +45,12 @@ ykpers_include_HEADERS += ykcore/ykstatus.h ykcore/ykcore.h ykcore/ykdef.h ykpers_include_HEADERS += ykpbkdf2.h lib_LTLIBRARIES = libykpers-1.la -libykpers_1_la_SOURCES = ykpers.c ykpers-version.c ykpbkdf2.c ykpers-json.c +libykpers_1_la_SOURCES = ykpers.c ykpers-version.c ykpbkdf2.c +if JSON +libykpers_1_la_SOURCES += ykpers-json.c +else +libykpers_1_la_SOURCES += ykpers-nojson.c +endif libykpers_1_la_SOURCES += ykpers_lcl.h ykpers-json.h ykpers_lcl.c libykpers_1_la_SOURCES += rfc4634/hmac.c rfc4634/usha.c rfc4634/sha.h \ rfc4634/sha1.c rfc4634/sha224-256.c rfc4634/sha384-512.c \ diff --git a/configure.ac b/configure.ac index 093f4b0..ec10bfa 100644 --- a/configure.ac +++ b/configure.ac @@ -125,8 +125,16 @@ AM_CONDITIONAL([BACKEND_LIBUSB_1_0], test x$with_backend = xlibusb-1.0) AM_CONDITIONAL([BACKEND_OSX], test x$with_backend = xosx) AM_CONDITIONAL([BACKEND_WINDOWS], test x$with_backend = xwindows) -PKG_CHECK_MODULES([libjson], [json-c], [], [ - PKG_CHECK_MODULES([libjson], [json])]) +AC_ARG_WITH([json], + AC_HELP_STRING([--without-json], [without JSON YCFG support]), + [with_json=$withval], [with_json=yes]) +if test x$with_json = xyes; then + PKG_CHECK_MODULES([libjson], [json-c], [], [ + PKG_CHECK_MODULES([libjson], [json], [], [with_json=no])]) +fi +AC_MSG_CHECKING([whether to use json library]) +AC_MSG_RESULT([$with_json]) +AM_CONDITIONAL([JSON], [test "$with_json" = yes]) # Check for json_object_to_json_string_ext, needed for pretty printing. am_save_CFLAGS="$CFLAGS" -- 2.39.5