fix libzbar detection
authorChristian Grothoff <christian@grothoff.org>
Wed, 3 Apr 2019 11:53:09 +0000 (13:53 +0200)
committerChristian Grothoff <christian@grothoff.org>
Wed, 3 Apr 2019 11:53:09 +0000 (13:53 +0200)
configure.ac

index 793612df3ac038d01cc10cd2692a30005ff578ff..ac8ed60c2c402b6543267c4c8e2558d7dfdbee41 100644 (file)
@@ -534,6 +534,39 @@ else
   AC_DEFINE([HAVE_LIBBLUETOOTH],[0],[Lacking bluetooth library])
 fi
 
+# check for zbar library
+zbar=0
+AC_MSG_CHECKING(for libzbar)
+AC_ARG_WITH(zbar,
+   [  --with-zbar=PFX    base of libzbar installation],
+   [AC_MSG_RESULT([$with_zbar])
+    case $with_zbar in
+      no)
+        ;;
+      yes)
+        AC_CHECK_HEADERS(zbar.h,
+          AC_CHECK_LIB([zbar], [zbar_processor_create],
+            zbar=1))
+        ;;
+      *)
+        LDFLAGS="-L$with_zbar/lib $LDFLAGS"
+        CPPFLAGS="-I$with_zbar/include $CPPFLAGS"
+        AC_CHECK_HEADERS(zbar.h,
+          AC_CHECK_LIB([zbar], [zbar_processor_create],
+            EXT_LIB_PATH="-L$with_zbar/lib $EXT_LIB_PATH"
+            zbar=1))
+        ;;
+    esac
+   ],
+   [AC_MSG_RESULT([--with-zbar not specified])
+    AC_CHECK_HEADERS(zbar.h,
+     AC_CHECK_LIB([zbar], [zbar_processor_create],
+      zbar=1))])
+AM_CONDITIONAL(HAVE_ZBAR, [test "$zbar" = 1])
+AS_IF([test "x$zbar" = x1],
+      [AC_DEFINE([HAVE_ZBAR],[1],[Have zbar library])],
+      [AC_DEFINE([HAVE_ZBAR],[0],[Lacking zbar library])])
+
 # check for jansson library
 jansson=0
 AC_MSG_CHECKING(for libjansson)
@@ -563,6 +596,7 @@ AC_ARG_WITH(jansson,
      AC_CHECK_LIB([jansson], [json_loads],
       jansson=1))])
 AM_CONDITIONAL(HAVE_JANSSON, [test "$jansson" = 1])
+AM_CONDITIONAL(HAVE_JSON, [test x$jansson = x1])
 AS_IF([test "x$jansson" = x1],
       [AC_DEFINE([HAVE_JANSSON],[1],[Have jansson library])],
       [AC_DEFINE([HAVE_JANSSON],[0],[Lacking jansson library])])
@@ -1431,9 +1465,6 @@ AC_DEFINE_UNQUOTED([HAVE_GNUTLS], $gnutls, [We have GnuTLS])
 AM_CONDITIONAL(HAVE_GNUTLS_DANE, test x$gnutls_dane = x1)
 AC_DEFINE_UNQUOTED([HAVE_GNUTLS_DANE], $gnutls_dane, [We have GnuTLS with DANE support])
 
-# check for libzbar library, required for optional gnunet-qr
-PKG_CHECK_MODULES([libzbar], [zbar >= 0.10], [have_zbar=1 ], [have_zbar=0 ])
-AM_CONDITIONAL([HAVE_ZBAR], [test "$have_zbar" = 1])
 
 
 # Test if we are building for superMUC