1b85037dbSmrg#  Copyright 2005 Adam Jackson.
2b85037dbSmrg#
3b85037dbSmrg#  Permission is hereby granted, free of charge, to any person obtaining a
4b85037dbSmrg#  copy of this software and associated documentation files (the "Software"),
5b85037dbSmrg#  to deal in the Software without restriction, including without limitation
6b85037dbSmrg#  on the rights to use, copy, modify, merge, publish, distribute, sub
7b85037dbSmrg#  license, and/or sell copies of the Software, and to permit persons to whom
8b85037dbSmrg#  the Software is furnished to do so, subject to the following conditions:
9b85037dbSmrg#
10b85037dbSmrg#  The above copyright notice and this permission notice (including the next
11b85037dbSmrg#  paragraph) shall be included in all copies or substantial portions of the
12b85037dbSmrg#  Software.
13b85037dbSmrg#
14b85037dbSmrg#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15b85037dbSmrg#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16b85037dbSmrg#  FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
17b85037dbSmrg#  ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18b85037dbSmrg#  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19b85037dbSmrg#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20b85037dbSmrg#
21b85037dbSmrg# Process this file with autoconf to produce a configure script
22b85037dbSmrg
23b85037dbSmrg# Initialize Autoconf
24b85037dbSmrgAC_PREREQ([2.60])
25b85037dbSmrgAC_INIT([xf86-input-synaptics],
2628515619Smrg        [1.7.1],
27b85037dbSmrg        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
28b85037dbSmrg        [xf86-input-synaptics])
29b85037dbSmrgAC_CONFIG_SRCDIR([Makefile.am])
30b85037dbSmrgAC_CONFIG_HEADERS([config.h])
31b85037dbSmrgAC_CONFIG_AUX_DIR(.)
32b85037dbSmrg
33b85037dbSmrg# Initialize Automake
34b85037dbSmrgAM_INIT_AUTOMAKE([foreign dist-bzip2])
35b85037dbSmrgAM_MAINTAINER_MODE
36b85037dbSmrg
37b85037dbSmrg# Initialize libtool
38b85037dbSmrgAC_DISABLE_STATIC
39b85037dbSmrgAC_PROG_LIBTOOL
40b85037dbSmrg
4128515619Smrg# Initialize X.Org macros 1.13 or later for XORG_ENABLE_UNIT_TESTS
42b85037dbSmrgm4_ifndef([XORG_MACROS_VERSION],
4328515619Smrg          [m4_fatal([must install xorg-macros 1.13 or later before running autoconf/autogen])])
4428515619SmrgXORG_MACROS_VERSION(1.13)
45b85037dbSmrgXORG_DEFAULT_OPTIONS
4628515619SmrgXORG_ENABLE_UNIT_TESTS
47b85037dbSmrg
48b85037dbSmrg# Checks for libraries.
49b85037dbSmrgAC_CHECK_LIB([m], [rint])
50b85037dbSmrg
51b85037dbSmrg# Store the list of server defined optional extensions in REQUIRED_MODULES
5228515619Smrgm4_ifndef([XORG_DRIVER_CHECK_EXT],
5328515619Smrg          [m4_fatal([must install xorg-server development files before running autoconf/autogen])])
54b85037dbSmrgXORG_DRIVER_CHECK_EXT(RANDR, randrproto)
55b85037dbSmrg
56b85037dbSmrg# Obtain compiler/linker options for the Synaptics driver dependencies
5728515619SmrgPKG_CHECK_MODULES(XORG, [inputproto >= 2.1.99.3] [xorg-server >= 1.12] xproto inputproto $REQUIRED_MODULES)
58b85037dbSmrg
59b85037dbSmrg# X Server SDK location is required to install Synaptics header files
60b85037dbSmrg# This location is also relayed in the xorg-synaptics.pc file
61b85037dbSmrgsdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
62b85037dbSmrgAC_SUBST([sdkdir])
63b85037dbSmrg
64b85037dbSmrg# -----------------------------------------------------------------------------
65b85037dbSmrg#			Configuration options
66b85037dbSmrg# -----------------------------------------------------------------------------
67b85037dbSmrg# Define a configure option for an alternate input module directory
68b85037dbSmrgAC_ARG_WITH(xorg-module-dir,
69b85037dbSmrg            AC_HELP_STRING([--with-xorg-module-dir=DIR],
70b85037dbSmrg                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
71b85037dbSmrg            [moduledir="$withval"],
72b85037dbSmrg            [moduledir="$libdir/xorg/modules"])
73b85037dbSmrginputdir=${moduledir}/input
74b85037dbSmrgAC_SUBST(inputdir)
75b85037dbSmrg
76b85037dbSmrg# Define a configure option for an alternate X Server configuration directory
77b85037dbSmrgsysconfigdir=`$PKG_CONFIG --variable=sysconfigdir xorg-server`
78b85037dbSmrgAC_ARG_WITH(xorg-conf-dir,
79b85037dbSmrg            AC_HELP_STRING([--with-xorg-conf-dir=DIR],
80b85037dbSmrg                           [Default xorg.conf.d directory [[default=from $PKG_CONFIG xorg-server]]]),
81b85037dbSmrg            [configdir="$withval"],
82b85037dbSmrg            [configdir="$sysconfigdir"])
83b85037dbSmrgAC_SUBST(configdir)
84b85037dbSmrgAM_CONDITIONAL(HAS_XORG_CONF_DIR, [test "x$sysconfigdir" != "x"])
85b85037dbSmrg
86b85037dbSmrg# Define a configure option to enable code debugging
87b85037dbSmrgAC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],
88b85037dbSmrg                                    [Enable debugging (default: disabled)]),
89b85037dbSmrg                                    [DEBUGGING=$enableval], [DEBUGGING=no])
90b85037dbSmrgif test "x$DEBUGGING" = xyes; then
91b85037dbSmrg   AC_DEFINE(DEBUG, 1, [Enable debugging code])
92b85037dbSmrgfi
93b85037dbSmrgAM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
94b85037dbSmrg
95b85037dbSmrg# -----------------------------------------------------------------------------
96b85037dbSmrg#		Determine which backend, if any, to build
97b85037dbSmrg# -----------------------------------------------------------------------------
98b85037dbSmrgAC_MSG_CHECKING([which optional backends will be build])
99b85037dbSmrgcase "${host}" in
100b85037dbSmrg*linux*)
10128515619Smrg	AC_MSG_RESULT([ps2comm alpscomm eventcomm])
10228515619Smrg	BUILD_PS2COMM="yes"
103b85037dbSmrg	BUILD_EVENTCOMM="yes"
104b85037dbSmrg	;;
10528515619Smrg*freebsd* | *netbsd* | *dragonfly*)
10628515619Smrg	AC_MSG_RESULT([ps2comm alpscomm psmcomm])
10728515619Smrg	BUILD_PS2COMM="yes"
108b85037dbSmrg	BUILD_PSMCOMM="yes"
10928515619Smrg	;;
11028515619Smrg*solaris* | *gnu*)
11128515619Smrg	AC_MSG_RESULT([ps2comm alpscomm])
11228515619Smrg	BUILD_PS2COMM="yes"
113b85037dbSmrg	;;
114b85037dbSmrg*)
11528515619Smrg	AC_MSG_ERROR([Cannot find suitable backends for this platform.])
116b85037dbSmrg	;;
117b85037dbSmrgesac
11828515619Smrgif test "x$BUILD_EVENTCOMM" = xyes; then
11928515619Smrg    AC_DEFINE(BUILD_EVENTCOMM, 1, [Optional backend eventcomm enabled])
12028515619Smrg
12128515619Smrg    # Obtain compiler/linker options for mtdev
12228515619Smrg    PKG_CHECK_MODULES(MTDEV, mtdev)
12328515619Smrgfi
12428515619Smrgif test "x$BUILD_PSMCOMM" = xyes; then
12528515619Smrg    AC_DEFINE(BUILD_PSMCOMM, 1, [Optional backend psmcomm enabled])
12628515619Smrgfi
12728515619Smrgif test "x$BUILD_PS2COMM" = xyes; then
12828515619Smrg    AC_DEFINE(BUILD_PS2COMM, 1, [Optional backend ps2comm and alpscomm enabled])
12928515619Smrgfi
130b85037dbSmrgAM_CONDITIONAL([BUILD_EVENTCOMM], [test "x${BUILD_EVENTCOMM}" = "xyes"])
131b85037dbSmrgAM_CONDITIONAL([BUILD_PSMCOMM], [test "x${BUILD_PSMCOMM}" = "xyes"])
13228515619SmrgAM_CONDITIONAL([BUILD_PS2COMM], [test "x${BUILD_PS2COMM}" = "xyes"])
133b85037dbSmrg
134b85037dbSmrg# -----------------------------------------------------------------------------
135b85037dbSmrg#			Dependencies for synclient and syndaemon
136b85037dbSmrg# -----------------------------------------------------------------------------
137b85037dbSmrg# Obtain compiler/linker options for the Synaptics apps dependencies
138b85037dbSmrgPKG_CHECK_MODULES(XI, x11 inputproto [xi >= 1.2])
139b85037dbSmrg
140b85037dbSmrg# The syndaemon program uses an optional XRecord extension implementation
141b85037dbSmrg# If libxtst >= 1.0.99 is installed, Cflags contains the path to record.h
142b85037dbSmrg# If recordproto < 1.13.99.1 is installed, Cflags contains the path to record.h
143b85037dbSmrgPKG_CHECK_MODULES(XTST, xtst recordproto, have_libxtst="yes", have_libxtst="no")
144b85037dbSmrgif test "x$have_libxtst" = "xyes" ; then
145b85037dbSmrg   # Header record.h may come from the xtst or recordproto package, or may be missing
146b85037dbSmrg   SAVE_CPPFLAGS="$CPPFLAGS"
147b85037dbSmrg   CPPFLAGS="$CPPFLAGS $XTST_CFLAGS"
148b85037dbSmrg   AC_CHECK_HEADERS([X11/extensions/record.h],,,[#include <X11/Xlib.h>])
149b85037dbSmrg   CPPFLAGS="$SAVE_CPPFLAGS"
150b85037dbSmrgfi
151b85037dbSmrg# -----------------------------------------------------------------------------
152b85037dbSmrg
15328515619Smrg# Workaround overriding sdkdir to be able to create a tarball when user has no
15428515619Smrg# write permission in sdkdir. See DISTCHECK_CONFIGURE_FLAGS in Makefile.am
15528515619SmrgAC_ARG_WITH([sdkdir], [], [sdkdir="$withval"])
15628515619Smrg
157b85037dbSmrgAC_CONFIG_FILES([Makefile
158b85037dbSmrg                src/Makefile
159b85037dbSmrg                man/Makefile
160b85037dbSmrg                tools/Makefile
161b85037dbSmrg                conf/Makefile
162b85037dbSmrg                include/Makefile
16328515619Smrg                test/Makefile
164b85037dbSmrg                xorg-synaptics.pc])
165b85037dbSmrgAC_OUTPUT
166b85037dbSmrg
167