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.57)
25AC_INIT([xf86-video-openchrome],
26        [0.6.0],
27        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
28        [xf86-video-openchrome])
29
30AC_DEFINE_UNQUOTED([VIA_MAJOR_VERSION],
31                   [$(echo $PACKAGE_VERSION | sed -e 's/^\([[0-9]]*\)\.[[0-9]]*\.[[0-9]]*/\1/')],
32                   [Major version])
33AC_DEFINE_UNQUOTED([VIA_MINOR_VERSION],
34                   [$(echo $PACKAGE_VERSION | sed -e 's/^[[0-9]]*\.\([[0-9]]*\)\.[[0-9]]*/\1/')],
35                   [Minor version])
36AC_DEFINE_UNQUOTED([VIA_PATCHLEVEL],
37                   [$(echo $PACKAGE_VERSION | sed -e 's/^[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)/\1/')],
38                   [Patch version])
39
40AC_CONFIG_SRCDIR([Makefile.am])
41AC_CONFIG_HEADERS([config.h])
42AC_CONFIG_AUX_DIR(.)
43
44AM_INIT_AUTOMAKE([foreign dist-bzip2])
45AM_MAINTAINER_MODE
46
47# Initialize libtool
48AC_DISABLE_STATIC
49AC_PROG_LIBTOOL
50AC_SYS_LARGEFILE
51
52AH_TOP([#include "xorg-server.h"])
53
54AC_ARG_WITH(xorg-module-dir,
55            AC_HELP_STRING([--with-xorg-module-dir=DIR],
56                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
57            [moduledir="$withval"],
58            [moduledir="$libdir/xorg/modules"])
59
60AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
61				    [Enable debugging support [[default=no]]]),
62              [DEBUG="$enableval"],
63              [DEBUG=no])
64
65AC_ARG_ENABLE(xv-debug, AC_HELP_STRING([--enable-xv-debug],
66				    [Enable XVideo debugging support [[default=no]]]),
67              [XV_DEBUG="$enableval"],
68              [XV_DEBUG=no])
69
70AC_ARG_ENABLE(viaregtool, AC_HELP_STRING([--enable-viaregtool],
71				    [Enable build of registers dumper tool [[default=no]]]),
72              [TOOLS="$enableval"],
73              [TOOLS=no])
74
75# Checks for extensions
76XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
77XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
78XORG_DRIVER_CHECK_EXT(XV, videoproto)
79XORG_DRIVER_CHECK_EXT(XF86DRI, xextproto x11)
80XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
81
82# Checks for pkg-config packages
83PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto glproto $REQUIRED_MODULES])
84PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
85 HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
86 HAVE_XEXTPROTO_71="no")
87AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ])
88
89# Checks for libraries.
90
91# Checks for header files.
92AC_HEADER_STDC
93
94save_CPPFLAGS="$CPPFLAGS"
95CPPFLAGS="$XORG_CFLAGS $CPPFLAGS"
96AC_CHECK_HEADER(xf86Modes.h,[XMODES=yes],[XMODES=no],[#include "xorg-server.h"])
97PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.11.0],
98 HAVE_PCIACCESS="yes"; AC_DEFINE(HAVE_PCIACCESS, 1, [libpciacces available]),
99 HAVE_PCIACCESS="no")
100AC_SUBST([PCIACCESS_CFLAGS])
101AC_SUBST([PCIACCESS_LIBS])
102
103PKG_CHECK_MODULES(DRI, [libdrm >= 2.4.4 xf86driproto],
104 DRI="yes"; AC_DEFINE(HAVE_DRI, 1, [DRI is available]),
105 DRI="no")
106AC_MSG_CHECKING([whether to build KMS support])
107AC_MSG_RESULT([$DRI])
108
109AM_CONDITIONAL(DRI, test x$DRI = xyes)
110if test "$DRI" = yes; then
111        AC_DEFINE(XF86DRI,1,[Enable DRI driver support])
112
113	AC_CHECK_HEADER([damage.h],
114		[have_damage_h="yes"], [have_damage_h="no"],[-])
115        if test "$have_damage_h" = yes; then
116                AC_DEFINE(DAMAGE,1,[Use Damage extension])
117        fi
118
119        PKG_CHECK_MODULES(LIBUDEV, [libudev], [LIBUDEV=yes], [LIBUDEV=no])
120        if test "x$LIBUDEV" = xyes; then
121        	AC_DEFINE(HAVE_LIBUDEV, 1,[libudev support])
122        fi
123
124        case "$host_cpu" in
125            i*86)
126                XVMC=yes ;;
127            amd64*|x86_64*)
128                XVMC=yes ;;
129            *)
130                XVMC=no ;;
131        esac
132else
133        XVMC="no"
134fi
135
136if test "x$XVMC" = xyes; then
137	AC_CHECK_HEADERS(pthread.h sys/ioctl.h sys/time.h time.h,,[XVMC="no"; break],)
138	PKG_CHECK_MODULES(XVMC, [x11 xext xvmc])
139fi
140
141AC_MSG_CHECKING([whether to build XvMC driver support])
142AC_MSG_RESULT([$XVMC])
143
144AM_CONDITIONAL(XVMC, test x$XVMC = xyes)
145
146AM_CONDITIONAL(DEBUG, test x$DEBUG = xyes)
147if test "$DEBUG" = yes; then
148        AC_DEFINE(HAVE_DEBUG,1,[Enable debug support])
149fi
150
151AM_CONDITIONAL(XV_DEBUG, test x$XV_DEBUG = xyes)
152if test "$XV_DEBUG" = yes; then
153        AC_DEFINE(XV_DEBUG,1,[Enable XVideo debug support])
154fi
155
156AM_CONDITIONAL(TOOLS, test x$TOOLS = xyes)
157if test "$TOOLS" = yes; then
158        AC_DEFINE(TOOLS,1,[Enable build of registers dumper tool])
159fi
160
161AC_SUBST([DRI_CFLAGS])
162AC_SUBST([XORG_CFLAGS])
163AC_SUBST([moduledir])
164
165DRIVER_NAME=openchrome
166AC_SUBST([DRIVER_NAME])
167
168AC_DEFINE(X_USE_LINEARFB,1,[Compatibility define for older Xen])
169AC_DEFINE(X_USE_REGION_NULL,1,[Compatibility define for older Xen])
170AC_DEFINE(X_HAVE_XAAGETROP,1,[Compatibility define for older Xen])
171AC_DEFINE(X_NEED_I2CSTART,1,[Compatibility define for older Xen])
172
173DRIVER_MAN_SUFFIX="4"
174AC_SUBST([DRIVER_MAN_SUFFIX])
175
176XORG_MANPAGE_SECTIONS
177XORG_RELEASE_VERSION
178
179AC_OUTPUT([
180	Makefile
181	src/xvmc/Makefile
182	src/Makefile
183	man/Makefile
184	tools/Makefile
185])
186