configure.ac revision 2a51b5be
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-mach64],
25        6.8.2,
26        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
27        xf86-video-mach64)
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# Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG
38m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])])
39XORG_MACROS_VERSION(1.2)
40
41# Checks for programs.
42AC_DISABLE_STATIC
43AC_PROG_LIBTOOL
44AC_PROG_CC
45XORG_CWARNFLAGS
46
47AH_TOP([#include "xorg-server.h"])
48
49AC_ARG_WITH(xorg-module-dir,
50            AC_HELP_STRING([--with-xorg-module-dir=DIR],
51                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
52            [moduledir="$withval"],
53            [moduledir="$libdir/xorg/modules"])
54
55AC_ARG_ENABLE(dri, AC_HELP_STRING([--disable-dri],
56                                  [Disable DRI support [[default=auto]]]),
57              [DRI="$enableval"],
58              [DRI=auto])
59
60AC_ARG_ENABLE(exa,
61              AC_HELP_STRING([--disable-exa],
62                             [Disable EXA support [[default=enabled]]]),
63              [EXA="$enableval"],
64              [EXA=yes])
65
66# Checks for extensions
67XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto)
68XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
69XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
70XORG_DRIVER_CHECK_EXT(XV, videoproto)
71XORG_DRIVER_CHECK_EXT(XF86MISC, xf86miscproto)
72XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
73
74# Checks for pkg-config packages
75PKG_CHECK_MODULES(XORG, [xorg-server >= 1.2 xproto fontsproto $REQUIRED_MODULES])
76PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
77                  HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
78                  HAVE_XEXTPROTO_71="no")
79AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ])
80sdkdir=$(pkg-config --variable=sdkdir xorg-server)
81
82# Checks for libraries.
83
84# Checks for header files.
85AC_HEADER_STDC
86
87if test "$DRI" != no; then
88	AC_CHECK_FILE([${sdkdir}/dri.h],
89                      [have_dri_h="yes"], [have_dri_h="no"])
90	AC_CHECK_FILE([${sdkdir}/sarea.h],
91                      [have_sarea_h="yes"], [have_sarea_h="no"])
92	AC_CHECK_FILE([${sdkdir}/dristruct.h],
93                      [have_dristruct_h="yes"], [have_dristruct_h="no"])
94	AC_CHECK_FILE([${sdkdir}/damage.h],
95                      [have_damage_h="yes"], [have_damage_h="no"])
96fi
97
98AC_MSG_CHECKING([whether to include DRI support])
99if test x$DRI = xauto; then
100	if test "$have_dri_h" = yes -a \
101                "$have_sarea_h" = yes -a \
102                "$have_dristruct_h" = yes; then
103		DRI="yes"
104	else
105		DRI="no"
106	fi
107fi
108AC_MSG_RESULT([$DRI])
109
110AM_CONDITIONAL(DRI, test x$DRI = xyes)
111if test "$DRI" = yes; then
112	PKG_CHECK_MODULES(DRI, [libdrm >= 2.2 xf86driproto])
113        AC_DEFINE(XF86DRI,1,[Enable DRI driver support])
114        AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
115fi
116
117# Note that this is sort of inverted from drivers/ati/Imakefile in
118# the monolith.  We test for foo, not for !foo (i.e. ATMISC_CPIO, not
119# ATIMISC_AVOID_CPIO), but the defines are negative.  So beware.  Oh yeah,
120# TV_OUT is the special case where it's a positive define, not AVOID_TV_OUT.
121
122# AVOID_CPIO: Only x86, amd64, and alpha are cool with CPIO.  It needs a
123# little-endian, undirected PIO space of at least 64kB.
124# AVOID_DGA: ???
125# ATI_TV_OUT: This only works on x86.
126
127ATIMISC_CPIO=no
128ATIMISC_DGA=yes
129ATIMISC_TV_OUT=no
130
131case $host_cpu in
132  i*86)
133    ATIMISC_TV_OUT=yes
134    ATIMISC_CPIO=yes
135    ;;
136  x86_64|amd64|alpha|ia64)
137    ATIMISC_CPIO=yes
138    ;;
139  sparc)
140    ATIMISC_DGA=no
141    ;;
142  *)
143    ;;
144esac
145
146AC_MSG_CHECKING([whether to include PIO support])
147AM_CONDITIONAL(ATIMISC_CPIO, test "x$ATIMISC_CPIO" = xyes)
148if test "x$ATIMISC_CPIO" = xyes; then
149	AC_MSG_RESULT([yes, PIO])
150else
151	AC_DEFINE(AVOID_CPIO, 1, [Avoid PIO and use MMIO for atimisc.])
152	AC_MSG_RESULT([no, MMIO])
153fi
154
155AC_MSG_CHECKING([whether to include DGA support])
156AC_MSG_RESULT([$ATIMISC_DGA])
157AM_CONDITIONAL(ATIMISC_DGA, test "x$ATIMISC_DGA" = xyes)
158if ! test "x$ATIMISC_DGA" = xyes; then
159	AC_DEFINE(AVOID_DGA, 1, [Do not build DGA support.])
160fi
161
162AC_MSG_CHECKING([whether to include TV Out support])
163AC_MSG_RESULT([$ATIMISC_TV_OUT])
164AM_CONDITIONAL(ATIMISC_TV_OUT, test "x$ATIMISC_TV_OUT" = xyes)
165if test "x$ATIMISC_TV_OUT" = xyes; then
166	AC_DEFINE(TV_OUT, 1, [Build TV-Out support for atimisc.])
167fi
168
169AC_DEFINE(USE_XAA, 1, [Build support for XAA])
170
171# Properly handle EXA.
172AC_MSG_CHECKING([whether to enable EXA support])
173if test "x$EXA" = xyes; then
174        AC_MSG_RESULT(yes)
175
176        SAVE_CPPFLAGS="$CPPFLAGS"
177        CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
178        AC_CHECK_HEADER(exa.h,
179                       [have_exa_h="yes"], [have_exa_h="no"])
180        CPPFLAGS="$SAVE_CPPFLAGS"
181else
182        AC_MSG_RESULT(no)
183fi 
184
185SAVE_CPPFLAGS="$CPPFLAGS"
186CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
187if test "x$have_exa_h" = xyes; then
188        AC_MSG_CHECKING([whether EXA version is at least 2.0.0])
189        AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
190#include "exa.h"
191#if EXA_VERSION_MAJOR < 2
192#error OLD EXA!
193#endif
194                          ]])],
195                          [USE_EXA=yes],
196                          [USE_EXA=no])
197        AC_MSG_RESULT($USE_EXA)
198
199        if test "x$USE_EXA" = xyes; then
200                AC_DEFINE(USE_EXA, 1, [Build support for Exa])
201        fi
202fi
203
204AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
205	      [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no],
206	      [#include "xorg-server.h"])
207
208CPPFLAGS="$SAVE_CPPFLAGS"
209
210AM_CONDITIONAL(USE_EXA, test "x$USE_EXA" = xyes)
211
212if test "x$XSERVER_LIBPCIACCESS" = xyes; then
213    PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
214    XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
215fi
216AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
217
218AC_SUBST([XORG_CFLAGS])
219AC_SUBST([DRI_CFLAGS])
220AC_SUBST([moduledir])
221
222DRIVER_NAME=mach64
223AC_SUBST([DRIVER_NAME])
224
225XORG_MANPAGE_SECTIONS
226XORG_RELEASE_VERSION
227XORG_CHECK_LINUXDOC
228XORG_CHANGELOG
229
230AC_MSG_NOTICE(
231[Please change the Driver line in xorg.conf from "ati" to "mach64"]
232[ or install the ati wrapper as well:]
233[    git://anongit.freedesktop.org/git/xorg/driver/xf86-video-ati]
234)
235
236AC_OUTPUT([
237	Makefile
238	src/Makefile
239	man/Makefile
240])
241