Link libraries directly to compile on some systems (debian).
authorMikael Magnusson <mikachu@gmail.com>
Sun, 22 May 2011 15:42:34 +0000 (17:42 +0200)
committerDana Jansens <danakj@orodu.net>
Mon, 1 Aug 2011 15:51:50 +0000 (11:51 -0400)
If program (A) is linked to library (B) which is linked to library (C),
then A must also link C directly in order to use things from it directly.

Makefile.am
configure.ac
m4/x11.m4

index c3feae6..f59d3e7 100644 (file)
@@ -170,6 +170,8 @@ openbox_openbox_CPPFLAGS = \
        -DCONFIGDIR=\"$(configdir)\" \
        -DG_LOG_DOMAIN=\"Openbox\"
 openbox_openbox_LDADD = \
+       $(XINERAMA_LIBS) \
+       $(XRANDR_LIBS) \
        $(SM_LIBS) \
        $(GLIB_LIBS) \
        $(X_LIBS) \
@@ -321,9 +323,11 @@ tools_obxprop_obxprop_SOURCES = \
 ## gdm-control ##
 
 tools_gdm_control_gdm_control_CPPFLAGS = \
+       $(XAUTH_CFLAGS) \
        $(X_CFLAGS) \
        $(GLIB_CFLAGS)
 tools_gdm_control_gdm_control_LDADD = \
+       $(XAUTH_LIBS) \
        $(X_LIBS) \
        $(GLIB_LIBS)
 tools_gdm_control_gdm_control_SOURCES = \
index def3e21..dc5bd55 100644 (file)
@@ -208,6 +208,7 @@ X11_EXT_XRANDR
 X11_EXT_SHAPE
 X11_EXT_XINERAMA
 X11_EXT_SYNC
+X11_EXT_AUTH
 
 AC_CONFIG_FILES([
   Makefile
index d840d34..bff7e63 100644 (file)
--- a/m4/x11.m4
+++ b/m4/x11.m4
@@ -302,6 +302,59 @@ AC_DEFUN([X11_EXT_SYNC],
   fi
 ])
 
+# X11_EXT_AUTH()
+#
+# Check for the presence of the "Xau" X Window System extension.
+# Defines "AUTH, sets the $(AUTH) variable to "yes", and sets the $(LIBS)
+# appropriately if the extension is present.
+AC_DEFUN([X11_EXT_AUTH],
+[
+  AC_REQUIRE([X11_DEVEL])
+
+  # Store these
+  OLDLIBS=$LIBS
+  OLDCPPFLAGS=$CPPFLAGS
+
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  LIBS="$LIBS $X_LIBS"
+
+  AC_CHECK_LIB([Xau], [XauReadAuth],
+    AC_MSG_CHECKING([for X11/Xauth.h])
+    AC_TRY_LINK(
+    [
+      #include <X11/Xlib.h>
+      #include <X11/Xutil.h>
+      #include <X11/Xauth.h>
+    ],
+    [
+    ],
+    [
+      AC_MSG_RESULT([yes])
+      AUTH="yes"
+      AC_DEFINE([AUTH], [1], [Found the Xauth extension])
+
+      XAUTH_CFLAGS=""
+      XAUTH_LIBS="-lXau"
+      AC_SUBST(XAUTH_CFLAGS)
+      AC_SUBST(XAUTH_LIBS)
+    ],
+    [
+      AC_MSG_RESULT([no])
+      AUTH="no"
+    ])
+  )
+
+  LIBS=$OLDLIBS
+  CPPFLAGS=$OLDCPPFLAGS
+
+  AC_MSG_CHECKING([for the Xauth extension])
+  if test "$AUTH" = "yes"; then
+    AC_MSG_RESULT([yes])
+  else
+    AC_MSG_RESULT([no])
+  fi
+])
+
 # X11_SM()
 #
 # Check for the presence of SMlib for session management.