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