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
23AC_PREREQ(2.60)
24AC_INIT([xf86-input-vmmouse],
25        [13.2.0],
26        [https://gitlab.freedesktop.org/xorg/driver/xf86-input-vmmouse/issues],
27        xf86-input-vmmouse)
28
29AC_CONFIG_SRCDIR([Makefile.am])
30AC_CONFIG_AUX_DIR(.)
31AC_CONFIG_HEADERS([config.h])
32
33AM_INIT_AUTOMAKE([foreign dist-xz])
34
35# XORG_DEFAULT_OPTIONS below forces C99. Solaris GCC doesn't like that.
36AC_PROG_CC
37AC_PROG_CC_C89
38save_solaris_cc=$CC
39
40# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
41m4_ifndef([XORG_MACROS_VERSION],
42          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
43XORG_MACROS_VERSION(1.8)
44XORG_DEFAULT_OPTIONS
45
46DRIVER_NAME=vmmouse
47AC_SUBST([DRIVER_NAME])
48
49# Checks for programs.
50AC_DISABLE_STATIC
51AC_PROG_LIBTOOL
52
53AH_TOP([#include "xorg-server.h"])
54
55AC_ARG_WITH(xorg-module-dir,
56            AS_HELP_STRING([--with-xorg-module-dir=DIR],
57                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
58            [moduledir="$withval"],
59            [moduledir="$libdir/xorg/modules"])
60inputdir=${moduledir}/input
61AC_SUBST(inputdir)
62
63AC_ARG_WITH(xorg-conf-dir,
64            AS_HELP_STRING([--with-xorg-conf-dir=DIR],
65                           [Default xorg.conf.d directory [[default=from $PKG_CONFIG xorg-server]]]),
66            [XORG_CONF_DIR="$withval"],
67            [XORG_CONF_DIR="`$PKG_CONFIG --variable=sysconfigdir xorg-server`"])
68AC_SUBST(XORG_CONF_DIR)
69AM_CONDITIONAL(HAS_XORG_CONF_DIR, [test "x$XORG_CONF_DIR" != "x" && test "x$XORG_CONF_DIR" != "xno"])
70
71AC_ARG_WITH(hal-bin-dir,
72	    AS_HELP_STRING([--with-hal-bin-dir=DIR],
73			   [Directory where HAL binaries where installed [[default=$bindir]]]),
74	    [halbindir="$withval"],
75	    [halbindir="$bindir"])
76HAL_BIN_DIR=${halbindir}
77AC_SUBST(HAL_BIN_DIR)
78
79AC_ARG_WITH(hal-callouts-dir,
80	    AS_HELP_STRING([--with-hal-callouts-dir=DIR],
81			   [Directory where HAL expects its callout scripts to be located
82			    [[default=$libdir/hal]]]),
83	    [halcalloutsdir="$withval"],
84	    [halcalloutsdir="$libdir/hal"])
85HAL_CALLOUTS_DIR=${halcalloutsdir}
86AC_SUBST(HAL_CALLOUTS_DIR)
87
88AC_ARG_WITH(hal-fdi-dir,
89	    AS_HELP_STRING([--with-hal-fdi-dir=DIR],
90			   [Directory where HAL expects its fdi files to be located
91			   [[default=$datadir/hal/fdi/policy/20thirdparty]]]),
92	    [halfdidir="$withval"],
93	    [halfdidir="$datadir/hal/fdi/policy/20thirdparty"])
94HAL_FDI_DIR=${halfdidir}
95AC_SUBST(HAL_FDI_DIR)
96
97# Udev location for rules directory
98AC_ARG_WITH(udev-rules-dir,
99	    AS_HELP_STRING([--with-udev-rules-dir=DIR],
100			   [Directory where udev expects its rules files
101			   [[default=$libdir/udev/rules.d]]]),
102	    [udevdir="$withval"],
103	    [udevdir="$libdir/udev/rules.d"])
104UDEV_RULES_DIR=${udevdir}
105AC_SUBST(UDEV_RULES_DIR)
106AM_CONDITIONAL(HAS_UDEV_RULES_DIR, [test "x$UDEV_RULES_DIR" != "xno"])
107
108# Checks for extensions
109XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
110XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
111
112# Checks for pkg-config packages
113libudev_check=yes
114AC_ARG_WITH([libudev],
115	[AS_HELP_STRING([--without-libudev],
116		[Use to build without libudev on linux])],
117	[if test x$withval = xno; then libudev_check=no; fi]
118	[])
119
120case $host_os in
121     linux*)
122	 if test $libudev_check != no; then
123             PKG_CHECK_MODULES(LIBUDEV, [libudev],
124					[AC_DEFINE([HAVE_LIBUDEV], 1,
125					[Has libudev installed])],
126					[]);
127         fi
128	 AC_CHECK_FUNCS(ioperm iopl,[],
129			[AC_MSG_ERROR
130			([cannot determine how to elevate io permissions)]],[1])
131	 AC_DEFINE(VMMOUSE_OS_GENERIC, 1,
132	           [Building for iopl / ioperm capable OS])
133     ;;
134     *bsd*)
135         AC_DEFINE(VMMOUSE_OS_BSD, 1, [Building for BSD flavour])
136     ;;
137     solaris*)
138	 if test "x$GCC" = "xyes"; then
139            CC="$save_solaris_cc -fms-extensions"
140	 fi
141         AC_DEFINE(VMMOUSE_OS_SOLARIS, 1, [Building for Solaris flavour])
142     ;;
143     *)
144	 AC_CHECK_FUNCS(ioperm iopl,[],
145			[AC_MSG_ERROR
146			([cannot determine how to elevate io permissions)]],[1])
147	 AC_DEFINE(VMMOUSE_OS_GENERIC, 1)
148     ;;
149esac
150
151case $host_cpu in
152     i*86)
153	case $host_os in
154		*freebsd*)	AC_DEFINE(USE_DEV_IO) ;;
155		*netbsd*)	AC_DEFINE([USE_I386_IOPL], [], [BSD i386 iopl])
156				use_i386_iopl=yes ;;
157		*openbsd*)	AC_DEFINE([USE_I386_IOPL], [], [BSD i386 iopl])
158				use_i386_iopl=yes ;;
159	esac
160	;;
161     x86_64*|amd64*)
162	case $host_os in
163		*freebsd*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
164		*netbsd*)	AC_DEFINE(USE_X86_64_IOPL, 1, [BSD X86_64 iopl])
165				use_x86_64_iopl=yes ;;
166		*openbsd*)	AC_DEFINE(USE_AMD64_IOPL, 1, [BSD AMD64 iopl])
167				use_amd64_iopl=yes ;;
168	esac
169	;;
170esac
171
172if test x$use_i386_iopl = xyes; then
173   AC_CHECK_LIB(i386, i386_iopl,[],
174		[AC_MSG_ERROR([cannot find library for i386_iopl])])
175fi
176
177if test x$use_amd64_iopl = xyes; then
178   AC_CHECK_LIB(amd64, amd64_iopl,[],
179		[AC_MSG_ERROR([cannot find library for amd64_iopl])])
180fi
181
182if test x$use_x86_64_iopl = xyes; then
183   AC_CHECK_LIB(x86_64, x86_64_iopl,[],
184                [AC_MSG_ERROR([cannot find library for x86_64_iopl])])
185fi
186
187PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.1] xproto $REQUIRED_MODULES)
188
189PKG_CHECK_EXISTS([xorg-server >= 1.1.0],
190                 [AC_DEFINE([HAVE_XORG_SERVER_1_1_0], 1,
191                            [Has version 1.1.0 or greater of the Xserver])])
192
193PKG_CHECK_EXISTS([xorg-server > 1.4.99],
194		[AC_DEFINE([HAVE_XORG_SERVER_1_5_0], 1,
195		[Has version 1.5.0 or greater of the Xserver])])
196
197PKG_CHECK_EXISTS([xorg-server >= 1.3.99.0 xorg-server <= 1.4.0.90],
198                 [AC_DEFINE([CALL_CONVERSION_PROC], 1,
199                            [Call conversion_proc from within the driver, as
200                             Xserver doesn't])])
201PKG_CHECK_EXISTS([xorg-server > 1.4.0.90],
202		 [AC_DEFINE([ABS_VALUATOR_AXES], 1,
203			    [Define absolute valuator axes])])
204PKG_CHECK_EXISTS([xorg-server >= 1.6.0],
205		 [AC_DEFINE([NO_MOUSE_MODULE], 1,
206			    [Do not include built-in mouse module fallback])])
207
208# Checks for libraries.
209
210# Checks for header files.
211AC_HEADER_STDC
212
213AC_CONFIG_FILES([Makefile
214	shared/Makefile
215	src/Makefile
216	tools/Makefile
217	fdi/Makefile
218	man/Makefile])
219
220AC_OUTPUT
221