configure.ac revision ee82cb62
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.60]) 25AC_INIT([xf86-video-mga], 26 [1.6.5], 27 [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], 28 [xf86-video-mga]) 29AC_CONFIG_SRCDIR([Makefile.am]) 30AC_CONFIG_HEADERS([config.h]) 31 32# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS 33m4_ifndef([XORG_MACROS_VERSION], 34 [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) 35XORG_MACROS_VERSION(1.8) 36XORG_DEFAULT_OPTIONS 37 38AC_CONFIG_AUX_DIR(.) 39 40# Initialize Automake 41AM_INIT_AUTOMAKE([foreign dist-bzip2]) 42AM_MAINTAINER_MODE 43 44# Initialize libtool 45AC_DISABLE_STATIC 46AC_PROG_LIBTOOL 47 48AH_TOP([#include "xorg-server.h"]) 49 50# Define a configure option for an alternate module directory 51AC_ARG_WITH(xorg-module-dir, 52 AS_HELP_STRING([--with-xorg-module-dir=DIR], 53 [Default xorg module directory [[default=$libdir/xorg/modules]]]), 54 [moduledir="$withval"], 55 [moduledir="$libdir/xorg/modules"]) 56 57AC_ARG_ENABLE(dri, AS_HELP_STRING([--disable-dri], 58 [Disable DRI support [[default=auto]]]), 59 [DRI="$enableval"], 60 [DRI=auto]) 61AC_ARG_ENABLE(exa, 62 AS_HELP_STRING([--disable-exa], 63 [Disable EXA support [[default=enabled]]]), 64 [EXA="$enableval"], 65 [EXA=yes]) 66 67# Store the list of server defined optional extensions in REQUIRED_MODULES 68XORG_DRIVER_CHECK_EXT(RANDR, randrproto) 69XORG_DRIVER_CHECK_EXT(RENDER, renderproto) 70XORG_DRIVER_CHECK_EXT(XV, videoproto) 71XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) 72 73# Obtain compiler/linker options for the driver dependencies 74PKG_CHECK_MODULES(XORG, [xorg-server >= 1.1.0 xproto fontsproto $REQUIRED_MODULES]) 75sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server` 76 77# Checks for libraries. 78 79if test "x$DRI" != xno; then 80 AC_CHECK_FILE([${sdkdir}/dri.h], 81 [have_dri_h="yes"], [have_dri_h="no"]) 82 AC_CHECK_FILE([${sdkdir}/sarea.h], 83 [have_sarea_h="yes"], [have_sarea_h="no"]) 84 AC_CHECK_FILE([${sdkdir}/dristruct.h], 85 [have_dristruct_h="yes"], [have_dristruct_h="no"]) 86fi 87 88AC_MSG_CHECKING([whether to include DRI support]) 89if test "x$DRI" = xauto; then 90 if test "x$have_dri_h" = xyes && \ 91 test "x$have_sarea_h" = xyes && \ 92 test "x$have_dristruct_h" = xyes; then 93 DRI="yes" 94 else 95 DRI="no" 96 fi 97fi 98AC_MSG_RESULT([$DRI]) 99 100AM_CONDITIONAL(DRI, test "x$DRI" = xyes) 101if test "x$DRI" = xyes; then 102 PKG_CHECK_MODULES(DRI, [libdrm >= 2.0 xf86driproto]) 103 AC_DEFINE(MGADRI,1,[Enable DRI driver support]) 104 AC_DEFINE(MGADRI_DEVEL,1,[Enable developmental DRI driver support]) 105fi 106 107save_CFLAGS="$CFLAGS" 108CFLAGS="$XORG_CFLAGS" 109AC_CHECK_DECL(XSERVER_LIBPCIACCESS, 110 [XSERVER_LIBPCIACCESS=yes], [XSERVER_LIBPCIACCESS=no], 111 [#include "xorg-server.h"]) 112CFLAGS="$save_CFLAGS" 113 114save_CFLAGS="$CFLAGS" 115CFLAGS="$XORG_CFLAGS" 116AC_CHECK_DECL(xf86ModeBandwidth, 117 [AC_DEFINE(HAVE_XF86MODEBANDWIDTH, 1, [Have xf86ModeBandwidth])], 118 [], 119 [#include <X11/extensions/randr.h> 120 #include "xorg-server.h" 121 #include "xf86Modes.h"]) 122CFLAGS="$save_CFLAGS" 123 124if test "x$XSERVER_LIBPCIACCESS" = xyes; then 125 PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0]) 126fi 127AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes) 128 129 130AC_ARG_ENABLE(xaa, 131 AS_HELP_STRING([--enable-xaa], 132 [Enable legacy X Acceleration Architecture (XAA) [default=auto]]), 133 [XAA="$enableval"], 134 [XAA=auto]) 135if test "x$XAA" != xno; then 136 save_CFLAGS=$CFLAGS 137 save_CPPFLAGS=$CPPFLAGS 138 CFLAGS=$XORG_CFLAGS 139 CPPFLAGS="$XORG_CFLAGS" 140 AC_CHECK_HEADERS([xaa.h], XAA=yes, XAA=no) 141 CFLAGS=$save_CFLAGS 142 CPPFLAGS=$save_CPPFLAGS 143fi 144AC_MSG_CHECKING([whether to include XAA support]) 145AM_CONDITIONAL(XAA, test "x$XAA" = xyes) 146AC_MSG_RESULT([$XAA]) 147if test "x$XAA" = xyes; then 148 AC_DEFINE(USE_XAA, 1, [Build support for XAA]) 149fi 150 151# Properly handle EXA. 152AC_MSG_CHECKING([whether to enable EXA support]) 153if test "x$EXA" = xyes; then 154 AC_MSG_RESULT(yes) 155 156 SAVE_CPPFLAGS="$CPPFLAGS" 157 CPPFLAGS="$CPPFLAGS $XORG_CFLAGS" 158 AC_CHECK_HEADERS(exa.h, 159 [have_exa_h="yes"], [have_exa_h="no"], 160 [#include "xorg-server.h"]) 161 CPPFLAGS="$SAVE_CPPFLAGS" 162else 163 AC_MSG_RESULT(no) 164fi 165 166SAVE_CPPFLAGS="$CPPFLAGS" 167CPPFLAGS="$CPPFLAGS $XORG_CFLAGS" 168if test "x$have_exa_h" = xyes; then 169 AC_MSG_CHECKING([whether EXA version is at least 2.0.0]) 170 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ 171#include "xorg-server.h" 172#include "exa.h" 173#if EXA_VERSION_MAJOR < 2 174#error OLD EXA! 175#endif 176 ]])], 177 [USE_EXA=yes], 178 [USE_EXA=no]) 179 AC_MSG_RESULT($USE_EXA) 180 181 if test "x$USE_EXA" = xyes; then 182 AC_DEFINE(USE_EXA, 1, [Build support for Exa]) 183 fi 184fi 185CPPFLAGS="$SAVE_CPPFLAGS" 186 187AM_CONDITIONAL(USE_EXA, test "x$USE_EXA" = xyes) 188 189AC_SUBST([moduledir]) 190 191DRIVER_NAME=mga 192AC_SUBST([DRIVER_NAME]) 193 194AC_CONFIG_FILES([ 195 Makefile 196 src/Makefile 197 man/Makefile 198 util/Makefile 199]) 200AC_OUTPUT 201