add initial logic to detect zbar dependencies
authorng0 <ng0@n0.is>
Thu, 21 Nov 2019 16:21:35 +0000 (16:21 +0000)
committerng0 <ng0@n0.is>
Thu, 21 Nov 2019 16:21:35 +0000 (16:21 +0000)
no idea if it's really required, but at the very least
we need to be able to point to the X11 root.

configure.ac
src/util/Makefile.am

index c5c6586e56c23ac3c8daf257914cb62d19c45081..929b7187cc97df6d65a4bd78adb70395be76497a 100644 (file)
@@ -691,6 +691,132 @@ AS_IF([test "x$zbar" = x1],
       [AC_DEFINE([HAVE_ZBAR],[1],[Have zbar library])],
       [AC_DEFINE([HAVE_ZBAR],[0],[Lacking zbar library])])
 
+# libjpeg - pulled in by zbar which is required by gnunet-qr.
+# At least IJG's jpeg works. If you need more, extend this.
+jpeg=0
+AC_MSG_CHECKING(for jpeg)
+AC_ARG_WITH(zbar,
+   [  --with-jpeg=PREFIX (base of jpeg installation)],
+   [AC_MSG_RESULT([$with_jpeg])
+    AS_CASE([$with_jpeg],
+      [no],[],
+      [yes],[CHECK_LIBHEADER(JPEG, jpeg, jpeg_std_error, jpeglib.h,jpeg=1,,)],
+      [
+        LDFLAGS="-L$with_jpeg/lib $LDFLAGS"
+        CPPFLAGS="-I$with_jpeg/include $CPPFLAGS"
+        AC_CHECK_HEADERS(jpeglib.h,
+          AC_CHECK_LIB([jpeg], [jpeg_std_error],
+            EXT_LIB_PATH="-L$with_jpeg/lib $EXT_LIB_PATH"
+            jpeg=1))
+       ])
+   ],
+   [AC_MSG_RESULT([--with-jpeg not specified])
+    CHECK_LIBHEADER(JPEG, jpeg, jpeg_std_error, jpeglib.h,jpeg=1,,)])
+AM_CONDITIONAL(HAVE_JPEG, [test "$jpeg" = 1])
+AS_IF([test "x$jpeg" = x1],
+      [AC_DEFINE([HAVE_JPEG],[1],[Have jpeg library])],
+      [AC_DEFINE([HAVE_JPEG],[0],[Lacking jpeg library])])
+
+# libSM
+sm=0
+AC_MSG_CHECKING(for SM)
+AC_ARG_WITH(sm,
+   [  --with-sm=PREFIX (base of SM installation)],
+   [AC_MSG_RESULT([$with_sm])
+    AS_CASE([$with_sm],
+      [no],[],
+      [yes],[CHECK_LIBHEADER(SM, sm, SM_Error, X11/SM/SM.h,sm=1,,)],
+      [
+        LDFLAGS="-L$with_sm/lib $LDFLAGS"
+        CPPFLAGS="-I$with_sm/include $CPPFLAGS"
+        AC_CHECK_HEADERS(X11/SM/SM.h,
+          AC_CHECK_LIB([SM], [SM_Error],
+            EXT_LIB_PATH="-L$with_sm/lib $EXT_LIB_PATH"
+            sm=1))
+       ])
+   ],
+   [AC_MSG_RESULT([--with-sm not specified])
+    CHECK_LIBHEADER(SM, sm, SM_Error, X11/SM/SM.h,sm=1,,)])
+AM_CONDITIONAL(HAVE_SM, [test "$sm" = 1])
+AS_IF([test "x$sm" = x1],
+      [AC_DEFINE([HAVE_SM],[1],[Have sm library])],
+      [AC_DEFINE([HAVE_SM],[0],[Lacking sm library])])
+
+# libICE
+ice=0
+AC_MSG_CHECKING(for ICE)
+AC_ARG_WITH(ice,
+   [  --with-ice=PREFIX (base of ICE installation)],
+   [AC_MSG_RESULT([$with_ice])
+    AS_CASE([$with_ice],
+      [no],[],
+      [yes],[CHECK_LIBHEADER(ICE, ice, ICE_Error, X11/ICE/ICE.h,ice=1,,)],
+      [
+        LDFLAGS="-L$with_ice/lib $LDFLAGS"
+        CPPFLAGS="-I$with_ice/include $CPPFLAGS"
+        AC_CHECK_HEADERS(X11/ICE/ICE.h,
+          AC_CHECK_LIB([ICE], [ICE_Error],
+            EXT_LIB_PATH="-L$with_ice/lib $EXT_LIB_PATH"
+            ice=1))
+       ])
+   ],
+   [AC_MSG_RESULT([--with-ice not specified])
+    CHECK_LIBHEADER(ICE, ice, ICE_Error, X11/ICE/ICE.h,ice=1,,)])
+AM_CONDITIONAL(HAVE_ICE, [test "$ice" = 1])
+AS_IF([test "x$ice" = x1],
+      [AC_DEFINE([HAVE_ICE],[1],[Have ICE library])],
+      [AC_DEFINE([HAVE_ICE],[0],[Lacking ICE library])])
+
+# libX11
+x11=0
+AC_MSG_CHECKING(for X11)
+AC_ARG_WITH(x11,
+   [  --with-x11=PREFIX (base of X11 installation)],
+   [AC_MSG_RESULT([$with_x11])
+    AS_CASE([$with_x11],
+      [no],[],
+      [yes],[CHECK_LIBHEADER(X11, x11, X_PROTOCOL, X11/X.h,x11=1,,)],
+      [
+        LDFLAGS="-L$with_x11/lib $LDFLAGS"
+        CPPFLAGS="-I$with_x11/include $CPPFLAGS"
+        AC_CHECK_HEADERS(X11/X.h,
+          AC_CHECK_LIB([X11], [X_PROTOCOL],
+            EXT_LIB_PATH="-L$with_x11/lib $EXT_LIB_PATH"
+            x11=1))
+       ])
+   ],
+   [AC_MSG_RESULT([--with-x11 not specified])
+    CHECK_LIBHEADER(X11, x11, X_PROTOCOL, X11/X.h,x11=1,,)])
+AM_CONDITIONAL(HAVE_X11, [test "$x11" = 1])
+AS_IF([test "x$x11" = x1],
+      [AC_DEFINE([HAVE_X11],[1],[Have x11 library])],
+      [AC_DEFINE([HAVE_X11],[0],[Lacking x11 library])])
+
+# libXv
+xv=0
+AC_MSG_CHECKING(for Xv)
+AC_ARG_WITH(xv,
+   [  --with-xv=PREFIX (base of Xv installation)],
+   [AC_MSG_RESULT([$with_xv])
+    AS_CASE([$with_xv],
+      [no],[],
+      [yes],[CHECK_LIBHEADER(XV, xv, XvName, X11/extensions/Xv.h,xv=1,,)],
+      [
+        LDFLAGS="-L$with_xv/lib $LDFLAGS"
+        CPPFLAGS="-I$with_xv/include $CPPFLAGS"
+        AC_CHECK_HEADERS(X11/extensions/Xv.h,
+          AC_CHECK_LIB([Xv], [XvName],
+            EXT_LIB_PATH="-L$with_xv/lib $EXT_LIB_PATH"
+            xv=1))
+       ])
+   ],
+   [AC_MSG_RESULT([--with-xv not specified])
+    CHECK_LIBHEADER(XV, xv, XvName, X11/extensions/Xv.h,xv=1,,)])
+AM_CONDITIONAL(HAVE_XV, [test "$xv" = 1])
+AS_IF([test "x$xv" = x1],
+      [AC_DEFINE([HAVE_XV],[1],[Have Xv library])],
+      [AC_DEFINE([HAVE_XV],[0],[Lacking Xv library])])
+
 # check for jansson library
 jansson=0
 AC_MSG_CHECKING(for libjansson)
@@ -1981,6 +2107,31 @@ AS_IF([test "x$MANDOC_BINARY" = "false"],
       [AC_MSG_NOTICE([WARNING: optional mandoc binary not found])
        mandoc_msg="no"],
       [mandoc_msg="yes"])
+# -- jpeg
+AS_IF([test "x$jpeg" != "x1"],
+      [jpeg_msg="no"],
+      [jpeg_msg="yes"
+       zbar_msg="$zbar_msg jpeg"])
+# -- X11
+AS_IF([test "x$x11" != "x1"],
+      [X11_msg="no"],
+      [X11_msg="yes"
+       zbar_msg="$zbar_msg X11"])
+# -- SM
+AS_IF([test "x$sm" != "x1"],
+      [sm_msg="no"],
+      [sm_msg="yes"
+       zbar_msg="$zbar_msg sm"])
+# -- ICE
+AS_IF([test "x$ice" != "x1"],
+      [ICE_msg="no"],
+      [ICE_msg="yes"
+       zbar_msg="$zbar_msg ICE"])
+# -- XV
+AS_IF([test "x$xv" != "x1"],
+      [XV_msg="no"],
+      [XV_msg="yes"
+       zbar_msg="$zbar_msg XV"])
 # -- texinfo
 AS_IF([test "x$makeinfo" != "x1"],
       [texinfo_msg="no"],
@@ -2080,6 +2231,8 @@ AS_IF([test "$postgres" = true],
 # ---- 2. sort the lines,
 # ---- 3. replace the newlines with spaces.
 features_msg=`echo $features_msg | tr ' ' '\012' | sort | tr '\012' ' '`
+zbar_msg=`echo $zbar_msg | tr ' ' '\012' | sort | tr '\012' ' '`
+AC_SUBST(zbar_msg)
 AC_SUBST(features_msg)
 
 
@@ -2115,6 +2268,7 @@ ifconfig:                       ${ifconfig_msg}
 upnpc:                          ${upnpc_msg}
 gnutls:                         ${gnutls_msg}
 libzbar:                        ${libzbar_msg}
+libzbar dependencies found:     ${zbar_msg}
 java:                           ${java_msg}
 libmicrohttpd:                  ${libmicrohttpd_msg}
 libidn:                         ${libidn1_msg}${libidn2_msg}
index c240053ff1cce173180d369edd6af62897b15f2a..1278e1852b7ef232e366cc1f6ed8986ffc6e5dca 100644 (file)
@@ -249,8 +249,7 @@ gnunet_qr_SOURCES = \
 gnunet_qr_LDADD = \
   libgnunetutil.la \
   $(GN_LIBINTL)
-gnunet_qr_LDFLAGS= \
-  -lzbar
+gnunet_qr_LDFLAGS= -lzbar -ljpeg -lICE -lSM -lX11 -lXv
 
 plugin_LTLIBRARIES = \
   libgnunet_plugin_test.la