configure.ac revision 28515619
1#  Copyright 2005 Adam Jackson.
2#
3#  Permission is hereby granted, free of charge, to any person obtaining a
4#  copy of this software and associated documentation files (the "Software"),
5#  to deal in the Software without restriction, including without limitation
6#  on the rights to use, copy, modify, merge, publish, distribute, sub
7#  license, and/or sell copies of the Software, and to permit persons to whom
8#  the Software is furnished to do so, subject to the following conditions:
9#
10#  The above copyright notice and this permission notice (including the next
11#  paragraph) shall be included in all copies or substantial portions of the
12#  Software.
13#
14#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16#  FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
17#  ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18#  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20#
21# Process this file with autoconf to produce a configure script
22
23# Initialize Autoconf
24AC_PREREQ([2.60])
25AC_INIT([xf86-input-synaptics],
26        [1.7.1],
27        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
28        [xf86-input-synaptics])
29AC_CONFIG_SRCDIR([Makefile.am])
30AC_CONFIG_HEADERS([config.h])
31AC_CONFIG_AUX_DIR(.)
32
33# Initialize Automake
34AM_INIT_AUTOMAKE([foreign dist-bzip2])
35AM_MAINTAINER_MODE
36
37# Initialize libtool
38AC_DISABLE_STATIC
39AC_PROG_LIBTOOL
40
41# Initialize X.Org macros 1.13 or later for XORG_ENABLE_UNIT_TESTS
42m4_ifndef([XORG_MACROS_VERSION],
43          [m4_fatal([must install xorg-macros 1.13 or later before running autoconf/autogen])])
44XORG_MACROS_VERSION(1.13)
45XORG_DEFAULT_OPTIONS
46XORG_ENABLE_UNIT_TESTS
47
48# Checks for libraries.
49AC_CHECK_LIB([m], [rint])
50
51# Store the list of server defined optional extensions in REQUIRED_MODULES
52m4_ifndef([XORG_DRIVER_CHECK_EXT],
53          [m4_fatal([must install xorg-server development files before running autoconf/autogen])])
54XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
55
56# Obtain compiler/linker options for the Synaptics driver dependencies
57PKG_CHECK_MODULES(XORG, [inputproto >= 2.1.99.3] [xorg-server >= 1.12] xproto inputproto $REQUIRED_MODULES)
58
59# X Server SDK location is required to install Synaptics header files
60# This location is also relayed in the xorg-synaptics.pc file
61sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
62AC_SUBST([sdkdir])
63
64# -----------------------------------------------------------------------------
65#			Configuration options
66# -----------------------------------------------------------------------------
67# Define a configure option for an alternate input module directory
68AC_ARG_WITH(xorg-module-dir,
69            AC_HELP_STRING([--with-xorg-module-dir=DIR],
70                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
71            [moduledir="$withval"],
72            [moduledir="$libdir/xorg/modules"])
73inputdir=${moduledir}/input
74AC_SUBST(inputdir)
75
76# Define a configure option for an alternate X Server configuration directory
77sysconfigdir=`$PKG_CONFIG --variable=sysconfigdir xorg-server`
78AC_ARG_WITH(xorg-conf-dir,
79            AC_HELP_STRING([--with-xorg-conf-dir=DIR],
80                           [Default xorg.conf.d directory [[default=from $PKG_CONFIG xorg-server]]]),
81            [configdir="$withval"],
82            [configdir="$sysconfigdir"])
83AC_SUBST(configdir)
84AM_CONDITIONAL(HAS_XORG_CONF_DIR, [test "x$sysconfigdir" != "x"])
85
86# Define a configure option to enable code debugging
87AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],
88                                    [Enable debugging (default: disabled)]),
89                                    [DEBUGGING=$enableval], [DEBUGGING=no])
90if test "x$DEBUGGING" = xyes; then
91   AC_DEFINE(DEBUG, 1, [Enable debugging code])
92fi
93AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
94
95# -----------------------------------------------------------------------------
96#		Determine which backend, if any, to build
97# -----------------------------------------------------------------------------
98AC_MSG_CHECKING([which optional backends will be build])
99case "${host}" in
100*linux*)
101	AC_MSG_RESULT([ps2comm alpscomm eventcomm])
102	BUILD_PS2COMM="yes"
103	BUILD_EVENTCOMM="yes"
104	;;
105*freebsd* | *netbsd* | *dragonfly*)
106	AC_MSG_RESULT([ps2comm alpscomm psmcomm])
107	BUILD_PS2COMM="yes"
108	BUILD_PSMCOMM="yes"
109	;;
110*solaris* | *gnu*)
111	AC_MSG_RESULT([ps2comm alpscomm])
112	BUILD_PS2COMM="yes"
113	;;
114*)
115	AC_MSG_ERROR([Cannot find suitable backends for this platform.])
116	;;
117esac
118if test "x$BUILD_EVENTCOMM" = xyes; then
119    AC_DEFINE(BUILD_EVENTCOMM, 1, [Optional backend eventcomm enabled])
120
121    # Obtain compiler/linker options for mtdev
122    PKG_CHECK_MODULES(MTDEV, mtdev)
123fi
124if test "x$BUILD_PSMCOMM" = xyes; then
125    AC_DEFINE(BUILD_PSMCOMM, 1, [Optional backend psmcomm enabled])
126fi
127if test "x$BUILD_PS2COMM" = xyes; then
128    AC_DEFINE(BUILD_PS2COMM, 1, [Optional backend ps2comm and alpscomm enabled])
129fi
130AM_CONDITIONAL([BUILD_EVENTCOMM], [test "x${BUILD_EVENTCOMM}" = "xyes"])
131AM_CONDITIONAL([BUILD_PSMCOMM], [test "x${BUILD_PSMCOMM}" = "xyes"])
132AM_CONDITIONAL([BUILD_PS2COMM], [test "x${BUILD_PS2COMM}" = "xyes"])
133
134# -----------------------------------------------------------------------------
135#			Dependencies for synclient and syndaemon
136# -----------------------------------------------------------------------------
137# Obtain compiler/linker options for the Synaptics apps dependencies
138PKG_CHECK_MODULES(XI, x11 inputproto [xi >= 1.2])
139
140# The syndaemon program uses an optional XRecord extension implementation
141# If libxtst >= 1.0.99 is installed, Cflags contains the path to record.h
142# If recordproto < 1.13.99.1 is installed, Cflags contains the path to record.h
143PKG_CHECK_MODULES(XTST, xtst recordproto, have_libxtst="yes", have_libxtst="no")
144if test "x$have_libxtst" = "xyes" ; then
145   # Header record.h may come from the xtst or recordproto package, or may be missing
146   SAVE_CPPFLAGS="$CPPFLAGS"
147   CPPFLAGS="$CPPFLAGS $XTST_CFLAGS"
148   AC_CHECK_HEADERS([X11/extensions/record.h],,,[#include <X11/Xlib.h>])
149   CPPFLAGS="$SAVE_CPPFLAGS"
150fi
151# -----------------------------------------------------------------------------
152
153# Workaround overriding sdkdir to be able to create a tarball when user has no
154# write permission in sdkdir. See DISTCHECK_CONFIGURE_FLAGS in Makefile.am
155AC_ARG_WITH([sdkdir], [], [sdkdir="$withval"])
156
157AC_CONFIG_FILES([Makefile
158                src/Makefile
159                man/Makefile
160                tools/Makefile
161                conf/Makefile
162                include/Makefile
163                test/Makefile
164                xorg-synaptics.pc])
165AC_OUTPUT
166
167