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-amdgpu], 26 [23.0.0], 27 [https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/-/issues], 28 [xf86-video-amdgpu]) 29 30AC_CONFIG_SRCDIR([Makefile.am]) 31AC_CONFIG_HEADERS([config.h]) 32AC_CONFIG_MACRO_DIR([m4]) 33 34AC_CONFIG_AUX_DIR(.) 35 36# Initialize Automake 37AM_INIT_AUTOMAKE([foreign dist-xz]) 38AC_SYS_LARGEFILE 39 40# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS 41m4_ifndef([XORG_MACROS_VERSION], 42 [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) 43XORG_MACROS_VERSION(1.8) 44XORG_DEFAULT_OPTIONS 45 46# Initialize libtool 47AC_DISABLE_STATIC 48AC_PROG_LIBTOOL 49 50# Checks for programs. 51AM_PROG_CC_C_O 52 53if test "x$GCC" = "xyes"; then 54 CPPFLAGS="$CPPFLAGS -Wall" 55fi 56 57AH_TOP([#include "xorg-server.h"]) 58 59# Define a configure option for an alternate module directory 60AC_ARG_WITH(xorg-module-dir, 61 AS_HELP_STRING([--with-xorg-module-dir=DIR], 62 [Default xorg module directory [[default=$libdir/xorg/modules]]]), 63 [moduledir="$withval"], 64 [moduledir="$libdir/xorg/modules"]) 65 66# Store the list of server defined optional extensions in REQUIRED_MODULES 67XORG_DRIVER_CHECK_EXT(RANDR, randrproto) 68XORG_DRIVER_CHECK_EXT(RENDER, renderproto) 69XORG_DRIVER_CHECK_EXT(XV, videoproto) 70XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) 71 72# Checks for libraries. 73PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.89]) 74PKG_CHECK_MODULES(LIBDRM_AMDGPU, [libdrm_amdgpu >= 2.4.76]) 75PKG_CHECK_MODULES(GBM, [gbm]) 76 77# Obtain compiler/linker options for the driver dependencies 78PKG_CHECK_MODULES(XORG, [xorg-server >= 1.13 xproto fontsproto xf86driproto $REQUIRED_MODULES]) 79PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1], 80 HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]), 81 HAVE_XEXTPROTO_71="no") 82AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ]) 83 84# Section "OutputClass" is only supported as of xserver 1.16 85PKG_CHECK_EXISTS([xorg-server >= 1.16], 86 [sysconfigdir=`$PKG_CONFIG --variable=sysconfigdir xorg-server`], 87 [sysconfigdir=""]) 88AM_CONDITIONAL(HAS_XORG_CONF_DIR, [test "x$sysconfigdir" != "x"]) 89 90# Define a configure option for an alternate X Server configuration directory 91AC_ARG_WITH(xorg-conf-dir, 92 AS_HELP_STRING([--with-xorg-conf-dir=DIR], 93 [Default xorg.conf.d directory [[default=${prefix}/share/X11/xorg.conf.d]]]), 94 [configdir="$withval"], 95 [configdir='${prefix}/share/X11/xorg.conf.d']) 96AC_SUBST(configdir) 97 98AC_ARG_ENABLE([udev], 99 AS_HELP_STRING([--disable-udev], [Disable libudev support [default=auto]]), 100 [enable_udev="$enableval"], 101 [enable_udev=auto]) 102if test "x$enable_udev" != "xno"; then 103 PKG_CHECK_MODULES(LIBUDEV, [libudev], [LIBUDEV=yes], [LIBUDEV=no]) 104 if test "x$LIBUDEV" = xyes; then 105 AC_DEFINE(HAVE_LIBUDEV, 1,[libudev support]) 106 elif test "x$enable_udev" != "xauto"; then 107 AC_MSG_ERROR([Building with udev requested but libudev not found]) 108 fi 109fi 110AM_CONDITIONAL(LIBUDEV, test x$LIBUDEV = xyes) 111 112SAVE_CPPFLAGS="$CPPFLAGS" 113CPPFLAGS="$CPPFLAGS $XORG_CFLAGS $GBM_CFLAGS" 114 115AC_MSG_CHECKING([whether to include GLAMOR support]) 116AC_ARG_ENABLE(glamor, 117 AS_HELP_STRING([--disable-glamor], 118 [Disable glamor, a new GL-based acceleration [default=enabled]]), 119 [GLAMOR="$enableval"], 120 [GLAMOR=yes]) 121 122if test "x$GLAMOR" != "xno"; then 123 AC_CHECK_HEADERS([glamor.h], [GLAMOR_H="yes"], [GLAMOR_H="no"], [#include "xorg-server.h"]) 124 125 if test "x$GLAMOR_H" = xyes; then 126 AC_CHECK_DECL(GLAMOR_NO_DRI3, 127 [GLAMOR_XSERVER="yes"], [GLAMOR_XSERVER="no"], 128 [#include "xorg-server.h" 129 #include "glamor.h"]) 130 131 AC_CHECK_DECL(glamor_glyphs_init, 132 [AC_DEFINE(HAVE_GLAMOR_GLYPHS_INIT, 1, 133 [Have glamor_glyphs_init API])], [], 134 [#include "xorg-server.h" 135 #include "glamor.h"]) 136 137 AC_CHECK_DECL(glamor_egl_destroy_textured_pixmap, 138 [AC_DEFINE(HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP, 1, 139 [Have glamor_egl_destroy_textured_pixmap API])], [], 140 [#include "xorg-server.h" 141 #include "glamor.h"]) 142 143 AC_CHECK_DECL(glamor_finish, 144 [AC_DEFINE(HAVE_GLAMOR_FINISH, 1, 145 [Have glamor_finish API])], 146 [PKG_CHECK_MODULES(LIBGL, [gl])], 147 [#include "xorg-server.h" 148 #include "glamor.h"]) 149 fi 150 151 if test "x$GLAMOR_XSERVER" != xyes; then 152 PKG_CHECK_MODULES(LIBGLAMOR, [glamor >= 0.6.0]) 153 PKG_CHECK_MODULES(LIBGLAMOR_EGL, [glamor-egl]) 154 fi 155 AC_DEFINE(USE_GLAMOR, 1, [Enable glamor acceleration]) 156else 157 AC_MSG_RESULT([$GLAMOR]) 158fi 159AM_CONDITIONAL(GLAMOR, test x$GLAMOR != xno) 160 161AC_CHECK_DECL(RegionDuplicate, 162 [AC_DEFINE(HAVE_REGIONDUPLICATE, 1, 163 [Have RegionDuplicate API])], [], 164 [#include <xorg-server.h> 165 #include <regionstr.h>]) 166 167AC_CHECK_DECL(fbGlyphs, 168 [AC_DEFINE(HAVE_FBGLYPHS, 1, [Have fbGlyphs API])], [], 169 [#include <X11/Xmd.h> 170 #include <X11/Xfuncproto.h> 171 #include <X11/extensions/renderproto.h> 172 #include <xorg-server.h> 173 #include <picture.h> 174 #include <glyphstr.h> 175 #include <fbpict.h>]) 176 177AC_CHECK_DECL(xf86CursorResetCursor, 178 [AC_DEFINE(HAVE_XF86_CURSOR_RESET_CURSOR, 1, 179 [Have xf86CursorResetCursor API])], [], 180 [#include <xorg-server.h> 181 #include <xf86Cursor.h>]) 182 183AC_CHECK_DECL(GBM_BO_USE_LINEAR, 184 [AC_DEFINE(HAVE_GBM_BO_USE_LINEAR, 1, [Have GBM_BO_USE_LINEAR])], [], 185 [#include <stdlib.h> 186 #include <gbm.h>]) 187 188AC_CHECK_HEADERS([misyncshm.h], [], [], 189 [#include <X11/Xdefs.h> 190 #include <X11/Xfuncproto.h> 191 #include <xorg-server.h> 192 #include <screenint.h>]) 193 194AC_CHECK_HEADERS([present.h], [], [], 195 [#include <X11/Xmd.h> 196 #include <X11/Xproto.h> 197 #include "xorg-server.h" 198 #include <X11/X.h>]) 199 200AC_CHECK_HEADERS([dri3.h], [], [], 201 [#include <X11/Xmd.h> 202 #include <xorg-server.h>]) 203 204CPPFLAGS="$SAVE_CPPFLAGS" 205 206# Checks for headers/macros for byte swapping 207# Known variants: 208# <byteswap.h> bswap_16, bswap_32, bswap_64 (glibc) 209# <sys/endian.h> __swap16, __swap32, __swap64 (OpenBSD) 210# <sys/endian.h> bswap16, bswap32, bswap64 (other BSD's) 211# and a fallback to local macros if none of the above are found 212 213# if <byteswap.h> is found, assume it's the correct version 214AC_CHECK_HEADERS([byteswap.h]) 215 216# if <sys/endian.h> is found, have to check which version 217AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="no"]) 218 219if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then 220 AC_MSG_CHECKING([for __swap16 variant of <sys/endian.h> byteswapping macros]) 221 AC_LINK_IFELSE([AC_LANG_PROGRAM([ 222#include <sys/types.h> 223#include <sys/endian.h> 224 ], [ 225int a = 1, b; 226b = __swap16(a); 227 ]) 228], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no']) 229 AC_MSG_RESULT([$SYS_ENDIAN__SWAP]) 230 231 AC_MSG_CHECKING([for bswap16 variant of <sys/endian.h> byteswapping macros]) 232 AC_LINK_IFELSE([AC_LANG_PROGRAM([ 233#include <sys/types.h> 234#include <sys/endian.h> 235 ], [ 236int a = 1, b; 237b = bswap16(a); 238 ]) 239], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no']) 240 AC_MSG_RESULT([$SYS_ENDIAN_BSWAP]) 241 242 if test "$SYS_ENDIAN_BSWAP" = "yes" ; then 243 USE_SYS_ENDIAN_H=yes 244 BSWAP=bswap 245 else 246 if test "$SYS_ENDIAN__SWAP" = "yes" ; then 247 USE_SYS_ENDIAN_H=yes 248 BSWAP=__swap 249 else 250 USE_SYS_ENDIAN_H=no 251 fi 252 fi 253 254 if test "$USE_SYS_ENDIAN_H" = "yes" ; then 255 AC_DEFINE([USE_SYS_ENDIAN_H], 1, 256 [Define to use byteswap macros from <sys/endian.h>]) 257 AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, 258 [Define to 16-bit byteswap macro]) 259 AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, 260 [Define to 32-bit byteswap macro]) 261 AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, 262 [Define to 64-bit byteswap macro]) 263 fi 264fi 265 266AC_SUBST([moduledir]) 267 268DRIVER_NAME=amdgpu 269AC_SUBST([DRIVER_NAME]) 270 271AC_CONFIG_FILES([ 272 Makefile 273 src/Makefile 274 man/Makefile 275 conf/Makefile 276]) 277AC_OUTPUT 278 279dnl 280dnl Output some configuration info for the user 281dnl 282echo "" 283echo " prefix: $prefix" 284echo " exec_prefix: $exec_prefix" 285echo " libdir: $libdir" 286echo " includedir: $includedir" 287echo " configdir: $configdir" 288 289echo "" 290echo " CFLAGS: $CFLAGS" 291echo " CXXFLAGS: $CXXFLAGS" 292echo " Macros: $DEFINES" 293 294echo "" 295echo " Run '${MAKE-make}' to build xf86-video-amdgpu" 296echo "" 297