summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaetan Nadon <memsize@videotron.ca>2010-05-30 21:19:29 -0400
committerGaetan Nadon <memsize@videotron.ca>2010-05-31 12:42:57 -0400
commit8843aaf4806344a8bda0f2e981a77f61c18f8037 (patch)
treebdc568c46d9e54fa862c5ea99e6eb26eb27e13d6
parent76dd6ffee7257f9ff0aec5a9655de67f6e7973c9 (diff)
config: rework the synclient and syndaemon dependencies
The driver does not require inputproto package The hunting for record.h is done only if libXtst is installed AC_CHECK_HEADERS is used rather than checking for package versions HAVE_PROPERTIES is no longer required Normal config output: checking for XI... yes checking for XTST... yes checking for X11/extensions/record.h... yes Permutations of --enable-tools and dependencies: build_tools libXi installed Result ----------- --------------- --------- yes yes build tools auto yes build tools no yes skip build yes no abort configuration auto no warn and skip build no no warn and skip build Permutations of libXtst, record.h and recordproto libXtst record.h recordproto syndaemon installed installed installed using XRecord? yes yes yes yes yes no yes no no no yes no no yes yes no no no no no Other scenarios are possible where you have 2 different versions of record.h installed in different $prefix locations. The order of *_CFLAGS will determine which one gets picked first. Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
-rw-r--r--configure.ac78
-rw-r--r--tools/Makefile.am10
-rw-r--r--tools/syndaemon.c12
3 files changed, 47 insertions, 53 deletions
diff --git a/configure.ac b/configure.ac
index f674993..17851bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,54 +90,48 @@ AC_ARG_WITH(xorg-module-dir,
inputdir=${moduledir}/input
AC_SUBST(inputdir)
-# Checks for extensions
-XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
-# Checks for pkg-config packages
-PKG_CHECK_MODULES(XORG, xorg-server xproto $REQUIRED_MODULES)
-sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
-AC_SUBST([sdkdir])
+# Obtain compiler/linker options for the Synaptics driver dependencies
+PKG_CHECK_MODULES(XORG, xorg-server xproto)
-PKG_CHECK_MODULES(XORG16, [xorg-server >= 1.6],
- HAVE_PROPERTIES="yes"; AC_DEFINE(HAVE_PROPERTIES, 1,
- "Input Device Property support"),
- HAVE_PROPERTIES="no");
-AM_CONDITIONAL(HAVE_PROPERTIES, [ test "$HAVE_PROPERTIES" = "yes" ])
-AC_SUBST(HAVE_PROPERTIES)
-
-# Checks for libraries.
-AC_ARG_ENABLE(tools,
- AC_HELP_STRING([--enable-tools], [Build synclient and syndaemon [[default=auto]]]),
+# ----------------------------------------------------------------------------------
+# Dependencies for synclient and syndaemon
+# ----------------------------------------------------------------------------------
+AC_ARG_ENABLE([tools],
+ AS_HELP_STRING([--enable-tools], [Build synclient and syndaemon [[default=auto]]]),
[build_tools="$enableval"],
[build_tools="auto"])
-if test "x$build_tools" != "xno"; then
- # Record.h is either in recordproto up to 1.13.2 or in libXtst 1.1.
- PKG_CHECK_MODULES(XTST_1_1, [xtst >= 1.0.99.1], HAVE_LIBXTST="yes", HAVE_LIBXTST="no")
- PKG_CHECK_MODULES(RECORDPROTO_1_13, xtst [recordproto < 1.13.99.1], HAVE_RECORDPROTO="yes", HAVE_RECORDPROTO="no")
-
- if test "x$HAVE_LIBXTST" = "xyes" || test "x$HAVE_RECORDPROTO" = "xyes" ; then
- AC_DEFINE([HAVE_XRECORD],[],[Use XRecord])
- fi
-
- if test "x$HAVE_PROPERTIES" = "xyes"; then
- PKG_CHECK_MODULES(XI, x11 [xi >= 1.2],
- BUILD_TOOLS="yes"; AC_DEFINE(BUILD_TOOLS, 1, "Build synclient and syndaemon"),
- BUILD_TOOLS="no")
- else
- BUILD_TOOLS="no"
- fi
-
- if test "x$BUILD_TOOLS" = "xno"; then
- if test "x$build_tools" = "xyes"; then
- AC_MSG_ERROR([Dependencies failed for synclient and syndaemon.])
- else
- AC_MSG_WARN([Not building synclient and syndaemon.])
- fi
- fi
+# Obtain compiler/linker options common for both synclient and syndaemon dependencies
+PKG_CHECK_MODULES(XI, x11 inputproto [xi >= 1.2], have_depends="yes", have_depends="no")
+if test "x$have_depends" = "xyes"; then
+ if test "x$build_tools" != "xno"; then
+ # The syndaemon program uses an optional XRecord extension implementation
+ # If libxtst >= 1.0.99 is installed, Cflags contains the path to record.h
+ PKG_CHECK_MODULES(XTST, xtst, have_libxtst="yes", have_libxtst="no")
+ if test "x$have_libxtst" = "xyes" ; then
+ # If recordproto < 1.13.99.1 is installed, Cflags contains the path to record.h
+ PKG_CHECK_MODULES(RECORD_PROTO, recordproto, have_recordproto="yes", have_recordproto="no")
+ # Header record.h may come from the xtst or recordproto package, or may be missing
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $XTST_CFLAGS $RECORD_PROTO_CFLAGS"
+ AC_CHECK_HEADERS([X11/extensions/record.h],,,[#include <X11/Xlib.h>])
+ CPPFLAGS="$SAVE_CPPFLAGS"
+ fi
+ fi
+else
+ if test "x$build_tools" = "xyes"; then
+ AC_MSG_ERROR([Dependencies failed for synclient and syndaemon.])
+ else
+ AC_MSG_WARN([Not building synclient and syndaemon.])
+ fi
fi
-AM_CONDITIONAL(BUILD_TOOLS, [ test "$BUILD_TOOLS" = "yes" ])
-AC_SUBST(BUILD_TOOLS)
+AM_CONDITIONAL(BUILD_TOOLS, [test x$have_depends = xyes && test x$build_tools != xno])
+
+# ----------------------------------------------------------------------------------
+
+sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
+AC_SUBST([sdkdir])
AC_ARG_WITH(xorg-conf-dir,
AC_HELP_STRING([--with-xorg-conf-dir=DIR],
diff --git a/tools/Makefile.am b/tools/Makefile.am
index b1e851d..7f91a92 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -23,15 +23,15 @@ bin_PROGRAMS = \
synclient \
syndaemon
-AM_CFLAGS = -I$(top_srcdir)/include $(XTST_1_1_CFLAGS) $(RECORDPROTO_1_13_CFLAGS) -I$(sdkdir)
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(sdkdir)
+AM_CFLAGS = $(XI_CFLAGS)
+AM_LDFLAGS = -lm $(XI_LIBS)
synclient_SOURCES = synclient.c
-synclient_LDFLAGS = -lm $(XI_LIBS)
-synclient_CFLAGS = $(AM_CFLAGS) $(XI_CFLAGS)
syndaemon_SOURCES = syndaemon.c
-syndaemon_LDFLAGS = $(XTST_1_1_LIBS) $(RECORDPROTO_1_13_LIBS) $(XI_LIBS)
-syndaemon_CFLAGS = $(AM_CFLAGS) $(XI_CFLAGS)
+syndaemon_CFLAGS = $(AM_CFLAGS) $(XTST_CFLAGS) $(RECORD_PROTO_CFLAGS)
+syndaemon_LDFLAGS = $(AM_LDFLAGS) $(XTST_LIBS)
else
all:
@echo "Not building syndaemon and synclient."
diff --git a/tools/syndaemon.c b/tools/syndaemon.c
index 4fdcf76..d06fe5f 100644
--- a/tools/syndaemon.c
+++ b/tools/syndaemon.c
@@ -31,10 +31,10 @@
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/extensions/XInput.h>
-#ifdef HAVE_XRECORD
+#ifdef HAVE_X11_EXTENSIONS_RECORD_H
#include <X11/Xproto.h>
#include <X11/extensions/record.h>
-#endif /* HAVE_XRECORD */
+#endif /* HAVE_X11_EXTENSIONS_RECORD_H */
#include <stdio.h>
#include <stdlib.h>
@@ -263,7 +263,7 @@ setup_keyboard_mask(Display *display, int ignore_modifier_keys)
}
/* ---- the following code is for using the xrecord extension ----- */
-#ifdef HAVE_XRECORD
+#ifdef HAVE_X11_EXTENSIONS_RECORD_H
#define MAX_MODIFIERS 16
@@ -440,7 +440,7 @@ void record_main_loop(Display* display, double idle_time) {
XFreeModifiermap(cbres.modifiers);
}
-#endif /* HAVE_XRECORD */
+#endif /* HAVE_X11_EXTENSIONS_RECORD_H */
static XDevice *
dp_get_device(Display *dpy)
@@ -590,7 +590,7 @@ main(int argc, char *argv[])
pad_disabled = False;
store_current_touchpad_state();
-#ifdef HAVE_XRECORD
+#ifdef HAVE_X11_EXTENSIONS_RECORD_H
if (use_xrecord)
{
if(check_xrecord(display))
@@ -601,7 +601,7 @@ main(int argc, char *argv[])
exit(2);
}
} else
-#endif /* HAVE_XRECORD */
+#endif /* HAVE_X11_EXTENSIONS_RECORD_H */
{
setup_keyboard_mask(display, ignore_modifier_keys);