configure.ac revision 8c7da7f0
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.57)
24AC_INIT([xf86-video-intel],
25        2.4.0,
26        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
27        xf86-video-intel)
28
29AC_CONFIG_SRCDIR([Makefile.am])
30AM_CONFIG_HEADER([config.h])
31AC_CONFIG_AUX_DIR(.)
32
33AM_INIT_AUTOMAKE([dist-bzip2])
34
35AM_MAINTAINER_MODE
36
37# Checks for programs.
38AC_DISABLE_STATIC
39AC_PROG_LIBTOOL
40DOLT
41AC_PROG_CC
42AM_PROG_CC_C_O
43
44AC_CHECK_PROG(gen4asm, [intel-gen4asm], yes, no)
45AM_CONDITIONAL(HAVE_GEN4ASM, test x$gen4asm = xyes)
46
47AC_CHECK_HEADERS(sys/mman.h)
48AC_CHECK_FUNCS(mprotect)
49
50AH_TOP([#include "xorg-server.h"])
51
52AC_ARG_WITH(xorg-module-dir,
53            AC_HELP_STRING([--with-xorg-module-dir=DIR],
54                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
55            [moduledir="$withval"],
56            [moduledir="$libdir/xorg/modules"])
57
58AC_ARG_ENABLE(dri, AC_HELP_STRING([--disable-dri],
59                                  [Disable DRI support [[default=auto]]]),
60              [DRI="$enableval"],
61              [DRI=auto])
62
63AC_ARG_ENABLE(video-debug, AC_HELP_STRING([--enable-video-debug],
64                                  [Enable video debugging support [[default=no]]]),
65              [VIDEO_DEBUG="$enableval"],
66              [VIDEO_DEBUG=no])
67
68AC_ARG_WITH(xserver-source,AC_HELP_STRING([--with-xserver-source=XSERVER_SOURCE],
69					  [Path to X server source tree]),
70			   [ XSERVER_SOURCE="$withval" ],
71			   [ XSERVER_SOURCE="" ])
72
73AC_ARG_ENABLE(xvmc, AC_HELP_STRING([--disable-xvmc],
74                                  [Disable XvMC support [[default=auto]]]),
75              [XVMC="$enableval"],
76              [XVMC=auto])
77
78# Checks for extensions
79XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto)
80XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
81XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
82XORG_DRIVER_CHECK_EXT(XF86DRI, xextproto x11)
83XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
84
85# Checks for pkg-config packages
86PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto $REQUIRED_MODULES])
87sdkdir=$(pkg-config --variable=sdkdir xorg-server)
88
89# Checks for libraries.
90
91# Checks for header files.
92AC_HEADER_STDC
93
94AC_MSG_CHECKING([whether to include DRI support])
95if test x$DRI = xauto; then
96        AC_CHECK_FILE([${sdkdir}/dri.h],
97                      [have_dri_h="yes"], [have_dri_h="no"])
98        AC_CHECK_FILE([${sdkdir}/sarea.h],
99                      [have_sarea_h="yes"], [have_sarea_h="no"])
100        AC_CHECK_FILE([${sdkdir}/dristruct.h],
101                      [have_dristruct_h="yes"], [have_dristruct_h="no"])
102	AC_CHECK_FILE([${sdkdir}/damage.h],
103                      [have_damage_h="yes"], [have_damage_h="no"])
104
105        if test "$have_dri_h" = yes -a \
106                "$have_sarea_h" = yes -a \
107                "$have_dristruct_h" = yes; then
108                DRI="yes"
109        else
110                DRI="no"
111        fi
112fi
113AC_MSG_RESULT([$DRI])
114
115save_CFLAGS="$CFLAGS"
116CFLAGS="$XORG_CFLAGS"
117AC_CHECK_HEADER(xf86Modes.h,[XMODES=yes],[XMODES=no],[#include "xorg-server.h"])
118AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
119	      [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no],
120	      [#include "xorg-server.h"])
121CFLAGS="$save_CFLAGS"
122
123if test x$XSERVER_LIBPCIACCESS = xyes; then
124	PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10])
125else
126	PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10],
127				       have_libpciaccess=yes,
128				       have_libpciaccess=no)
129fi
130AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
131AM_CONDITIONAL(LIBPCIACCESS,
132	test "x$XSERVER_LIBPCIACCESS" = xyes -o "x$have_libpciaccess" = xyes)
133AM_CONDITIONAL(XMODES, test "x$XMODES" = xno)
134
135if test "x$XSERVER_SOURCE" = x; then
136	if test -d ../../xserver; then
137		XSERVER_SOURCE="`cd ../../xserver && pwd`"
138	fi
139fi
140	
141if test -d "$XSERVER_SOURCE"; then
142	case "$XSERVER_SOURCE" in
143	/*)
144		;;
145	*)
146		XSERVER_SOURCE="`cd $XSERVER_SOURCE && pwd`"
147		;;
148	esac
149	if test -f $srcdir/src/modes/xf86Modes.h; then
150		:
151	else
152		ln -sf $XSERVER_SOURCE/hw/xfree86/modes $srcdir/src/modes
153	fi
154	
155	if test -f $srcdir/src/parser/xf86Parser.h; then
156		:
157	else
158		ln -sf $XSERVER_SOURCE/hw/xfree86/parser $srcdir/src/parser
159	fi
160fi
161
162if test "x$XMODES" = xyes; then
163	AC_MSG_NOTICE([X server has new mode code])
164	AC_DEFINE(XMODES, 1,[X server has built-in mode code])
165	XMODES_CFLAGS=
166else
167	if test -f $srcdir/src/modes/xf86Modes.h -a -f $srcdir/src/parser/xf86Parser.h; then
168		AC_MSG_NOTICE([X server is missing new mode code, using local copy])
169	else
170		AC_MSG_ERROR([Must have X server >= 1.3 source tree for mode setting code. Please specify --with-xserver-source])
171	fi
172	XMODES_CFLAGS='-DXF86_MODES_RENAME -I$(top_srcdir)/src -I$(top_srcdir)/src/modes -I$(top_srcdir)/src/parser'
173fi
174
175AC_SUBST([XMODES_CFLAGS])
176
177SAVE_CPPFLAGS="$CPPFLAGS"
178CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
179
180AC_CHECK_DECL(xf86RotateFreeShadow,
181	      [AC_DEFINE(HAVE_FREE_SHADOW, 1, [have new FreeShadow API])],
182	      [],
183	      [#include <xorg-server.h>
184	       #include <windowstr.h>
185	       #include <xf86Crtc.h>])
186	     
187CPPFLAGS="$SAVE_CPPFLAGS"
188
189dnl Use lots of warning flags with GCC
190
191WARN_CFLAGS=""
192
193if test "x$GCC" = "xyes"; then
194	WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
195	-Wmissing-prototypes -Wmissing-declarations \
196	-Wnested-externs -fno-strict-aliasing"
197fi
198
199AM_CONDITIONAL(DRI, test x$DRI = xyes)
200if test "$DRI" = yes; then
201        PKG_CHECK_MODULES(DRI, [libdrm xf86driproto glproto])
202        AC_DEFINE(XF86DRI,1,[Enable DRI driver support])
203        AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
204	PKG_CHECK_MODULES(DRI_MM, [libdrm >= 2.4.0],[DRI_MM=yes], [DRI_MM=no])
205	if test "x$DRI_MM" = xyes; then
206		AC_DEFINE(XF86DRI_MM,1,[Extended DRI memory management])
207	fi
208	if test "$have_damage_h" = yes; then
209		AC_DEFINE(DAMAGE,1,[Use Damage extension])
210	fi
211
212	save_CFLAGS="$CFLAGS"
213	CFLAGS="$XORG_CFLAGS $DRI_CFLAGS"
214	AC_CHECK_TYPE(drm_i915_flip_t,
215		      [AC_DEFINE(HAVE_I915_FLIP, 1,
216			         [Have drm_i915_flip_t and related definitions])],
217		      [], [
218#include <inttypes.h>
219#include <i915_drm.h>
220])
221	CFLAGS="$save_CFLAGS"
222fi
223
224AM_CONDITIONAL(VIDEO_DEBUG, test x$VIDEO_DEBUG = xyes)
225if test "$VIDEO_DEBUG" = yes; then
226	AC_DEFINE(VIDEO_DEBUG,1,[Enable debug support])
227fi
228
229if test "$XVMC" = auto; then
230	XVMC="$DRI"
231fi
232if test "$XVMC" = yes && test "$DRI" = no; then
233	AC_MSG_ERROR([XvMC can't be enabled without DRI])
234fi
235if test "$XVMC" = yes; then
236	PKG_CHECK_MODULES(XVMCLIB, [xvmc], [XVMC=yes], [XVMC=no])
237fi
238AC_MSG_CHECKING([whether to include XvMC support])
239AC_MSG_RESULT([$XVMC])
240AM_CONDITIONAL(XVMC, test x$XVMC = xyes)
241if test "$XVMC" = yes; then
242	AC_DEFINE(ENABLE_XVMC,1,[Enable XvMC support])
243    	AC_SUBST([XVMCLIB_CFLAGS])
244fi
245
246
247AC_SUBST([DRI_CFLAGS])
248AC_SUBST([XORG_CFLAGS])
249AC_SUBST([WARN_CFLAGS])
250AC_SUBST([moduledir])
251
252DRIVER_NAME=intel
253AC_SUBST([DRIVER_NAME])
254
255m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.1.3 or later before running autoconf/autogen])])
256XORG_MACROS_VERSION(1.1.3)
257XORG_MANPAGE_SECTIONS
258XORG_RELEASE_VERSION
259
260XORG_CHECK_LINUXDOC
261
262AC_OUTPUT([
263	Makefile
264	src/Makefile
265	src/xvmc/Makefile
266	src/bios_reader/Makefile
267	src/ch7017/Makefile
268	src/ch7xxx/Makefile
269	src/ivch/Makefile
270	src/reg_dumper/Makefile
271	src/sil164/Makefile
272	src/tfp410/Makefile
273	man/Makefile
274])
275