configure.ac revision d7be9c72
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.4.13], 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(XF86DRI,1,[Enable DRI driver support]) 104 AC_DEFINE(XF86DRI_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 129AM_CONDITIONAL(USE_XAA, true) 130AC_DEFINE(USE_XAA, 1, [Build support for XAA]) 131 132# Properly handle EXA. 133AC_MSG_CHECKING([whether to enable EXA support]) 134if test "x$EXA" = xyes; then 135 AC_MSG_RESULT(yes) 136 137 SAVE_CPPFLAGS="$CPPFLAGS" 138 CPPFLAGS="$CPPFLAGS $XORG_CFLAGS" 139 AC_CHECK_HEADER(exa.h, 140 [have_exa_h="yes"], [have_exa_h="no"]) 141 CPPFLAGS="$SAVE_CPPFLAGS" 142else 143 AC_MSG_RESULT(no) 144fi 145 146SAVE_CPPFLAGS="$CPPFLAGS" 147CPPFLAGS="$CPPFLAGS $XORG_CFLAGS" 148if test "x$have_exa_h" = xyes; then 149 AC_MSG_CHECKING([whether EXA version is at least 2.0.0]) 150 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ 151#include "exa.h" 152#if EXA_VERSION_MAJOR < 2 153#error OLD EXA! 154#endif 155 ]])], 156 [USE_EXA=yes], 157 [USE_EXA=no]) 158 AC_MSG_RESULT($USE_EXA) 159 160 if test "x$USE_EXA" = xyes; then 161 AC_DEFINE(USE_EXA, 1, [Build support for Exa]) 162 fi 163fi 164CPPFLAGS="$SAVE_CPPFLAGS" 165 166AM_CONDITIONAL(USE_EXA, test "x$USE_EXA" = xyes) 167 168AC_SUBST([moduledir]) 169 170DRIVER_NAME=mga 171AC_SUBST([DRIVER_NAME]) 172 173AC_CONFIG_FILES([ 174 Makefile 175 src/Makefile 176 man/Makefile 177 util/Makefile 178]) 179AC_OUTPUT 180