configure.ac revision b85037db
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.3.0],
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.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
42m4_ifndef([XORG_MACROS_VERSION],
43          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
44XORG_MACROS_VERSION(1.8)
45XORG_DEFAULT_OPTIONS
46
47# Checks for libraries.
48AC_CHECK_LIB([m], [rint])
49
50# Store the list of server defined optional extensions in REQUIRED_MODULES
51XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
52
53# Obtain compiler/linker options for the Synaptics driver dependencies
54PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6] xproto inputproto $REQUIRED_MODULES)
55
56# X Server SDK location is required to install Synaptics header files
57# This location is also relayed in the xorg-synaptics.pc file
58sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
59AC_SUBST([sdkdir])
60
61DRIVER_NAME=synaptics
62AC_SUBST([DRIVER_NAME])
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([eventcomm])
102	BUILD_EVENTCOMM="yes"
103	AC_DEFINE(BUILD_EVENTCOMM, 1, [Optional backend eventcomm enabled])
104	;;
105*freebsd* | *openbsd* | *netbsd* | *dragonfly*)
106	AC_MSG_RESULT([psmcomm])
107	BUILD_PSMCOMM="yes"
108	AC_DEFINE(BUILD_PSMCOMM, 1, [Optional backend psmcomm enabled])
109	;;
110*)
111	AC_MSG_RESULT([none])
112	;;
113esac
114AM_CONDITIONAL([BUILD_EVENTCOMM], [test "x${BUILD_EVENTCOMM}" = "xyes"])
115AM_CONDITIONAL([BUILD_PSMCOMM], [test "x${BUILD_PSMCOMM}" = "xyes"])
116
117# -----------------------------------------------------------------------------
118#			Dependencies for synclient and syndaemon
119# -----------------------------------------------------------------------------
120# Obtain compiler/linker options for the Synaptics apps dependencies
121PKG_CHECK_MODULES(XI, x11 inputproto [xi >= 1.2])
122
123# The syndaemon program uses an optional XRecord extension implementation
124# If libxtst >= 1.0.99 is installed, Cflags contains the path to record.h
125# If recordproto < 1.13.99.1 is installed, Cflags contains the path to record.h
126PKG_CHECK_MODULES(XTST, xtst recordproto, have_libxtst="yes", have_libxtst="no")
127if test "x$have_libxtst" = "xyes" ; then
128   # Header record.h may come from the xtst or recordproto package, or may be missing
129   SAVE_CPPFLAGS="$CPPFLAGS"
130   CPPFLAGS="$CPPFLAGS $XTST_CFLAGS"
131   AC_CHECK_HEADERS([X11/extensions/record.h],,,[#include <X11/Xlib.h>])
132   CPPFLAGS="$SAVE_CPPFLAGS"
133fi
134# -----------------------------------------------------------------------------
135
136AC_CONFIG_FILES([Makefile
137                src/Makefile
138                man/Makefile
139                tools/Makefile
140                conf/Makefile
141                include/Makefile
142                xorg-synaptics.pc])
143AC_OUTPUT
144
145