configure.ac revision eda3803b
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)
24
25AC_INIT([xf86-video-mga],
26        1.4.10,
27        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
28        xf86-video-mga)
29
30XORG_RELEASE_VERSION
31
32AC_CONFIG_SRCDIR([Makefile.am])
33AM_CONFIG_HEADER([config.h])
34AC_CONFIG_AUX_DIR(.)
35
36AM_INIT_AUTOMAKE([dist-bzip2])
37
38AM_MAINTAINER_MODE
39
40# Checks for programs.
41AC_DISABLE_STATIC
42AC_PROG_LIBTOOL
43AC_PROG_CC
44
45AH_TOP([#include "xorg-server.h"])
46
47AC_ARG_WITH(xorg-module-dir,
48            AC_HELP_STRING([--with-xorg-module-dir=DIR],
49                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
50            [moduledir="$withval"],
51            [moduledir="$libdir/xorg/modules"])
52
53AC_ARG_ENABLE(dri, AC_HELP_STRING([--disable-dri],
54                                  [Disable DRI support [[default=auto]]]),
55              [DRI="$enableval"],
56              [DRI=auto])
57AC_ARG_ENABLE(exa,
58              AC_HELP_STRING([--disable-exa],
59                             [Disable EXA support [[default=enabled]]]),
60              [EXA="$enableval"],
61              [EXA=yes])
62
63# Checks for extensions
64XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
65XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
66XORG_DRIVER_CHECK_EXT(XV, videoproto)
67XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
68
69# Checks for pkg-config packages
70PKG_CHECK_MODULES(XORG, [xorg-server >= 1.1.0 xproto fontsproto $REQUIRED_MODULES])
71sdkdir=$(pkg-config --variable=sdkdir xorg-server)
72
73# Checks for libraries.
74
75# Checks for header files.
76AC_HEADER_STDC
77
78if test "x$DRI" != xno; then
79        AC_CHECK_FILE([${sdkdir}/dri.h],
80                      [have_dri_h="yes"], [have_dri_h="no"])
81        AC_CHECK_FILE([${sdkdir}/sarea.h],
82                      [have_sarea_h="yes"], [have_sarea_h="no"])
83        AC_CHECK_FILE([${sdkdir}/dristruct.h],
84                      [have_dristruct_h="yes"], [have_dristruct_h="no"])
85fi
86
87AC_MSG_CHECKING([whether to include DRI support])
88if test "x$DRI" = xauto; then
89        if test "x$have_dri_h" = xyes && \
90           test "x$have_sarea_h" = xyes && \
91           test "x$have_dristruct_h" = xyes; then
92                DRI="yes"
93        else
94                DRI="no"
95        fi
96fi
97AC_MSG_RESULT([$DRI])
98
99AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
100if test "x$DRI" = xyes; then
101        PKG_CHECK_MODULES(DRI, [libdrm >= 2.0 xf86driproto])
102        AC_DEFINE(XF86DRI,1,[Enable DRI driver support])
103        AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
104fi
105
106save_CFLAGS="$CFLAGS"
107CFLAGS="$XORG_CFLAGS"
108AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
109              [XSERVER_LIBPCIACCESS=yes], [XSERVER_LIBPCIACCESS=no],
110              [#include "xorg-server.h"])
111CFLAGS="$save_CFLAGS"
112
113save_CFLAGS="$CFLAGS"
114CFLAGS="$XORG_CFLAGS"
115AC_CHECK_DECL(xf86ModeBandwidth,
116	      [AC_DEFINE(HAVE_XF86MODEBANDWIDTH, 1, [Have xf86ModeBandwidth])],
117	      [],
118	      [#include <X11/extensions/randr.h>
119	       #include "xorg-server.h"
120	       #include "xf86Modes.h"])
121CFLAGS="$save_CFLAGS"
122
123if test "x$XSERVER_LIBPCIACCESS" = xyes; then
124    PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
125fi
126AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
127
128AM_CONDITIONAL(USE_XAA, true)
129AC_DEFINE(USE_XAA, 1, [Build support for XAA])
130
131# Properly handle EXA.
132AC_MSG_CHECKING([whether to enable EXA support])
133if test "x$EXA" = xyes; then
134    AC_MSG_RESULT(yes)
135
136    SAVE_CPPFLAGS="$CPPFLAGS"
137    CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
138    AC_CHECK_HEADER(exa.h,
139                   [have_exa_h="yes"], [have_exa_h="no"])
140    CPPFLAGS="$SAVE_CPPFLAGS"
141else
142    AC_MSG_RESULT(no)
143fi 
144
145SAVE_CPPFLAGS="$CPPFLAGS"
146CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
147if test "x$have_exa_h" = xyes; then
148    AC_MSG_CHECKING([whether EXA version is at least 2.0.0])
149    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
150#include "exa.h"
151#if EXA_VERSION_MAJOR < 2
152#error OLD EXA!
153#endif
154                      ]])],
155                      [USE_EXA=yes],
156                      [USE_EXA=no])
157    AC_MSG_RESULT($USE_EXA)
158
159    if test "x$USE_EXA" = xyes; then
160        AC_DEFINE(USE_EXA, 1, [Build support for Exa])
161    fi
162fi
163CPPFLAGS="$SAVE_CPPFLAGS"
164
165AM_CONDITIONAL(USE_EXA, test "x$USE_EXA" = xyes)
166
167AC_SUBST([DRI_CFLAGS])
168AC_SUBST([XORG_CFLAGS])
169AC_SUBST([moduledir])
170
171DRIVER_NAME=mga
172AC_SUBST([DRIVER_NAME])
173
174XORG_MANPAGE_SECTIONS
175XORG_RELEASE_VERSION
176
177AC_OUTPUT([
178	Makefile
179	src/Makefile
180	man/Makefile
181	util/Makefile
182])
183