configure.ac revision e3d74329
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-r128], 26 [6.10.0], 27 [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], 28 [xf86-video-r128]) 29AC_CONFIG_SRCDIR([Makefile.am]) 30AC_CONFIG_HEADERS([config.h]) 31AC_CONFIG_AUX_DIR(.) 32 33# Initialize Automake 34AM_INIT_AUTOMAKE([foreign dist-bzip2]) 35 36# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS 37m4_ifndef([XORG_MACROS_VERSION], 38 [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) 39XORG_MACROS_VERSION(1.8) 40XORG_DEFAULT_OPTIONS 41 42AM_MAINTAINER_MODE 43 44# Initialize libtool 45AC_DISABLE_STATIC 46AC_PROG_LIBTOOL 47 48if test "x$GCC" = "xyes"; then 49 CPPFLAGS="$CPPFLAGS -Wall" 50fi 51 52AH_TOP([#include "xorg-server.h"]) 53 54# Define a configure option for an alternate module directory 55AC_ARG_WITH(xorg-module-dir, 56 AS_HELP_STRING([--with-xorg-module-dir=DIR], 57 [Default xorg module directory [[default=$libdir/xorg/modules]]]), 58 [moduledir="$withval"], 59 [moduledir="$libdir/xorg/modules"]) 60 61AC_ARG_ENABLE(dri, AS_HELP_STRING([--disable-dri], 62 [Disable DRI support [[default=auto]]]), 63 [DRI="$enableval"], 64 [DRI=auto]) 65 66AC_ARG_ENABLE(exa, AS_HELP_STRING([--disable-exa], 67 [Disable EXA support [[default=enabled]]]), 68 [EXA="$enableval"], 69 [EXA=yes]) 70 71# Store the list of server defined optional extensions in REQUIRED_MODULES 72XORG_DRIVER_CHECK_EXT(RANDR, randrproto) 73XORG_DRIVER_CHECK_EXT(RENDER, renderproto) 74XORG_DRIVER_CHECK_EXT(XV, videoproto) 75XORG_DRIVER_CHECK_EXT(XF86MISC, xf86miscproto) 76XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) 77 78# Obtain compiler/linker options for the driver dependencies 79PKG_CHECK_MODULES(XORG, [xorg-server >= 1.3 xproto fontsproto $REQUIRED_MODULES]) 80PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1], 81 HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]), 82 HAVE_XEXTPROTO_71="no") 83AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ]) 84sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server` 85 86# Checks for libraries. 87 88if test "$DRI" != no; then 89 AC_CHECK_FILE([${sdkdir}/dri.h], 90 [have_dri_h="yes"], [have_dri_h="no"]) 91 AC_CHECK_FILE([${sdkdir}/sarea.h], 92 [have_sarea_h="yes"], [have_sarea_h="no"]) 93 AC_CHECK_FILE([${sdkdir}/dristruct.h], 94 [have_dristruct_h="yes"], [have_dristruct_h="no"]) 95 AC_CHECK_FILE([${sdkdir}/damage.h], 96 [have_damage_h="yes"], [have_damage_h="no"]) 97fi 98 99AC_MSG_CHECKING([whether to include DRI support]) 100if test x$DRI = xauto; then 101 if test "$have_dri_h" = yes -a \ 102 "$have_sarea_h" = yes -a \ 103 "$have_dristruct_h" = yes; then 104 DRI="yes" 105 else 106 DRI="no" 107 fi 108fi 109AC_MSG_RESULT([$DRI]) 110 111AM_CONDITIONAL(DRI, test x$DRI = xyes) 112if test "$DRI" = yes; then 113 PKG_CHECK_MODULES(DRI, [libdrm >= 2.2 xf86driproto]) 114 AC_DEFINE(R128DRI,1,[Enable DRI driver support]) 115 AC_DEFINE(R128DRI_DEVEL,1,[Enable developmental DRI driver support]) 116fi 117 118SAVE_CPPFLAGS="$CPPFLAGS" 119CPPFLAGS="$CPPFLAGS $XORG_CFLAGS" 120# Properly handle EXA. 121AC_MSG_CHECKING([whether to enable EXA support]) 122if test "x$EXA" = xyes; then 123 AC_MSG_RESULT(yes) 124 AC_CHECK_FILE(${sdkdir}/exa.h, [have_exa_h="yes"], [have_exa_h="no"]) 125else 126 AC_MSG_RESULT(no) 127fi 128 129SAVE_CPPFLAGS="$CPPFLAGS" 130CPPFLAGS="$CPPFLAGS $XORG_CFLAGS" 131if test "x$have_exa_h" = xyes; then 132 AC_MSG_CHECKING([whether EXA version is at least 2.0.0]) 133 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ 134#include "xorg-server.h" 135#include "exa.h" 136#if EXA_VERSION_MAJOR < 2 137#error OLD EXA! 138#endif 139 ]])], 140 [USE_EXA=yes], 141 [USE_EXA=no]) 142 AC_MSG_RESULT($USE_EXA) 143 144 if test "x$USE_EXA" = xyes; then 145 AC_DEFINE(USE_EXA, 1, [Build support for Exa]) 146 fi 147fi 148 149AC_CHECK_DECL(XSERVER_LIBPCIACCESS, 150 [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no], 151 [#include "xorg-server.h"]) 152CPPFLAGS="$SAVE_CPPFLAGS" 153 154AC_ARG_ENABLE(xaa, 155 AS_HELP_STRING([--enable-xaa], 156 [Enable legacy X Acceleration Architecture (XAA) [default=auto]]), 157 [XAA="$enableval"], 158 [XAA=auto]) 159if test "x$XAA" != xno; then 160 save_CFLAGS=$CFLAGS 161 save_CPPFLAGS=$CPPFLAGS 162 CFLAGS=$XORG_CFLAGS 163 CPPFLAGS="$XORG_CFLAGS" 164 AC_CHECK_HEADERS([xaa.h], XAA=yes, XAA=no) 165 CFLAGS=$save_CFLAGS 166 CPPFLAGS=$save_CPPFLAGS 167fi 168AC_MSG_CHECKING([whether to include XAA support]) 169AM_CONDITIONAL(XAA, test "x$XAA" = xyes) 170AC_MSG_RESULT([$XAA]) 171 172AM_CONDITIONAL(USE_EXA, test "x$USE_EXA" = xyes) 173 174if test "x$XSERVER_LIBPCIACCESS" = xyes; then 175 PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0]) 176 XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS" 177fi 178AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes) 179 180# Checks for headers/macros for byte swapping 181# Known variants: 182# <byteswap.h> bswap_16, bswap_32, bswap_64 (glibc) 183# <sys/endian.h> __swap16, __swap32, __swap64 (OpenBSD) 184# <sys/endian.h> bswap16, bswap32, bswap64 (other BSD's) 185# and a fallback to local macros if none of the above are found 186 187# if <byteswap.h> is found, assume it's the correct version 188AC_CHECK_HEADERS([byteswap.h]) 189 190# if <sys/endian.h> is found, have to check which version 191AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="no"]) 192 193if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then 194 AC_MSG_CHECKING([for __swap16 variant of <sys/endian.h> byteswapping macros]) 195 AC_LINK_IFELSE([AC_LANG_PROGRAM([ 196#include <sys/types.h> 197#include <sys/endian.h> 198 ], [ 199int a = 1, b; 200b = __swap16(a); 201 ]) 202], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no']) 203 AC_MSG_RESULT([$SYS_ENDIAN__SWAP]) 204 205 AC_MSG_CHECKING([for bswap16 variant of <sys/endian.h> byteswapping macros]) 206 AC_LINK_IFELSE([AC_LANG_PROGRAM([ 207#include <sys/types.h> 208#include <sys/endian.h> 209 ], [ 210int a = 1, b; 211b = bswap16(a); 212 ]) 213], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no']) 214 AC_MSG_RESULT([$SYS_ENDIAN_BSWAP]) 215 216 if test "$SYS_ENDIAN_BSWAP" = "yes" ; then 217 USE_SYS_ENDIAN_H=yes 218 BSWAP=bswap 219 else 220 if test "$SYS_ENDIAN__SWAP" = "yes" ; then 221 USE_SYS_ENDIAN_H=yes 222 BSWAP=__swap 223 else 224 USE_SYS_ENDIAN_H=no 225 fi 226 fi 227 228 if test "$USE_SYS_ENDIAN_H" = "yes" ; then 229 AC_DEFINE([USE_SYS_ENDIAN_H], 1, 230 [Define to use byteswap macros from <sys/endian.h>]) 231 AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, 232 [Define to 16-bit byteswap macro]) 233 AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, 234 [Define to 32-bit byteswap macro]) 235 AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, 236 [Define to 64-bit byteswap macro]) 237 fi 238fi 239 240AC_SUBST([moduledir]) 241 242DRIVER_NAME=r128 243AC_SUBST([DRIVER_NAME]) 244 245AC_MSG_NOTICE( 246[Please change the Driver line in xorg.conf from "ati" to "r128" or install] 247[the ati wrapper as well:] 248[ git://anongit.freedesktop.org/git/xorg/driver/xf86-video-ati] 249) 250 251AC_CONFIG_FILES([ 252 Makefile 253 src/Makefile 254 man/Makefile 255]) 256AC_OUTPUT 257