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 23AC_PREREQ([2.60]) 24AC_INIT([igt-gpu-tools], 25 [1.24], 26 [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI&component=IGT], 27 [igt-gpu-tools]) 28 29AC_CONFIG_SRCDIR([Makefile.am]) 30AC_CONFIG_HEADERS([config.h]) 31AC_CONFIG_MACRO_DIR([m4]) 32AC_CONFIG_AUX_DIR([build-aux]) 33AC_USE_SYSTEM_EXTENSIONS 34AC_SYS_LARGEFILE 35AC_GNU_SOURCE 36AC_CANONICAL_HOST 37AC_CANONICAL_TARGET 38 39AM_INIT_AUTOMAKE([1.12 foreign subdir-objects dist-bzip2]) 40AM_PATH_PYTHON([3],, [:]) 41 42AC_PROG_CC 43AC_PROG_LEX 44AC_PROG_YACC 45 46# Checks for functions, headers, structures, etc. 47AC_HEADER_STDC 48AC_CHECK_HEADERS([termios.h linux/kd.h sys/kd.h libgen.h sys/io.h]) 49AC_CHECK_MEMBERS([struct sysinfo.totalram],[],[],[AC_INCLUDES_DEFAULT 50 #include <sys/sysinfo.h> 51 ]) 52AC_CHECK_TYPES([sighandler_t],[],[],[AC_INCLUDES_DEFAULT 53#include <signal.h>]) 54AC_CHECK_FUNCS([swapctl]) 55AC_CHECK_FUNCS([asprintf]) 56AX_GCC_FUNC_ATTRIBUTE([constructor]) 57 58dnl Check for POSIX timers 59AC_CHECK_FUNCS(timer_create, [], [ 60 AC_CHECK_LIB(rt, timer_create, [ 61 TIMER_LIBS="-lrt" 62 ], [ 63 AC_CHECK_LIB(pthread, timer_create, [ 64 TIMER_LIBS="-lpthread" 65 ], [ 66 AC_MSG_ERROR([Failed to find library containing timer_create.]) 67 ]) 68 ]) 69]) 70AC_SUBST(TIMER_LIBS) 71 72dnl Check for memfd_create 73AC_CHECK_FUNCS(memfd_create) 74 75dnl Check for CPUID 76cpuid="yes" 77AC_TRY_LINK([ 78 #include <cpuid.h> 79 #include <stddef.h> 80 ], 81 [ 82 int eax, ebx, ecx, edx; 83 if (__get_cpuid_max(0, NULL) < 4) 84 return 0; 85 __cpuid_count(4, 0, eax, ebx, ecx, edx); 86 ], 87 [cpuid="yes"], 88 [cpuid="no"] 89) 90if test "x$cpuid" = "xyes"; then 91 AC_DEFINE(HAVE_CPUID_H, 1, [Found a useable cpuid.h]) 92fi 93 94# Initialize libtool 95AC_DISABLE_STATIC 96AC_PROG_LIBTOOL 97 98# Require X.Org macros 1.16 or later for XORG_TESTSET_CFLAG 99m4_ifndef([XORG_MACROS_VERSION], 100 [m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])]) 101XORG_MACROS_VERSION(1.16) 102XORG_DEFAULT_OPTIONS 103 104PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.82]) 105PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10]) 106PKG_CHECK_MODULES(KMOD, [libkmod]) 107PKG_CHECK_MODULES(PROCPS, [libprocps]) 108PKG_CHECK_MODULES(LIBUNWIND, [libunwind]) 109PKG_CHECK_MODULES(LIBDW, [libdw]) 110PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no]) 111 112if test x$have_valgrind = xyes; then 113 AC_DEFINE(HAVE_VALGRIND, 1, [Enable valgrind annotation support.]) 114fi 115 116case "$target_cpu" in 117 x86*|i?86) 118 build_x86="yes" 119 ;; 120 *) 121 build_x86="no" 122 ;; 123esac 124 125if test x"$build_x86" = xyes; then 126 PKG_CHECK_MODULES(OVERLAY_XVLIB, [xv x11 xext dri2proto >= 2.6], enable_overlay_xvlib=yes, enable_overlay_xvlib=no) 127 PKG_CHECK_MODULES(OVERLAY_XLIB, [cairo-xlib dri2proto >= 2.6], enable_overlay_xlib=yes, enable_overlay_xlib=no) 128 129 AC_CHECK_TOOL([LEG], [leg]) 130 if test x"$LEG" != xleg; then 131 enable_overlay_xvlib="no" 132 enable_overlay_xlib="no" 133 AC_MSG_NOTICE([Failed to find leg, required for overlay, try : apt-get install peg]) 134 fi 135else 136 enable_overlay_xvlib="no" 137 enable_overlay_xlib="no" 138fi 139AM_CONDITIONAL(BUILD_X86, [test "x$build_x86" = xyes]) 140 141AM_CONDITIONAL(BUILD_OVERLAY_XVLIB, [test "x$enable_overlay_xvlib" = xyes]) 142AM_CONDITIONAL(BUILD_OVERLAY_XLIB, [test "x$enable_overlay_xlib" = xyes]) 143AM_CONDITIONAL(BUILD_OVERLAY, [test "x$enable_overlay_xlib" = xyes -o "x$enable_overlay_xvlib" = "xyes"]) 144if test x$enable_overlay_xvlib = xyes; then 145 AC_DEFINE(HAVE_OVERLAY_XVLIB, 1, [Enable XV backend]) 146fi 147if test x$enable_overlay_xlib = xyes; then 148 AC_DEFINE(HAVE_OVERLAY_XLIB, 1, [Enable X backend]) 149fi 150PKG_CHECK_MODULES(XRANDR, xrandr >= 1.3, AC_DEFINE(HAVE_XRANDR, 1, [Have libXrandr]), [have_xrandr=no]) 151 152# for testdisplay 153PKG_CHECK_MODULES(CAIRO, [cairo >= 1.17.2], [], 154 [AC_MSG_WARN([Cairo too old, HDR formats not available. Upgrade to cairo 1.17.2]) 155 PKG_CHECK_MODULES(CAIRO, [cairo >= 1.12.0])] 156) 157PKG_CHECK_MODULES(LIBUDEV, [libudev]) 158PKG_CHECK_MODULES(GLIB, [glib-2.0]) 159PKG_CHECK_MODULES(PIXMAN, [pixman-1 >= 0.36.0], [], [ 160 AC_MSG_WARN([Pixman too old, HDR formats not available. Upgrade to pixman 0.36.0]) 161 PKG_CHECK_MODULES(PIXMAN, [pixman-1]) 162]) 163 164PKG_CHECK_MODULES(GSL, [gsl], [gsl=yes], [gsl=no]) 165AM_CONDITIONAL(HAVE_GSL, [test "x$gsl" = xyes]) 166 167PKG_CHECK_MODULES(ALSA, [alsa], [alsa=yes], [alsa=no]) 168AM_CONDITIONAL(HAVE_ALSA, [test "x$alsa" = xyes]) 169 170# for chamelium 171AC_ARG_ENABLE(chamelium, AS_HELP_STRING([--enable-chamelium], 172 [Enable building of chamelium libraries and tests (default: no)]), 173 [if test x$enableval = xyes; then enable_chamelium=yes; fi], 174 [enable_chamelium=no]) 175AM_CONDITIONAL(HAVE_CHAMELIUM, [test "x$enable_chamelium" = xyes]) 176if test "x$enable_chamelium" = xyes; then 177 PKG_CHECK_MODULES(XMLRPC, xmlrpc xmlrpc_util xmlrpc_client, 178 [xmlrpc=yes], [xmlrpc=no]) 179 if test x"$xmlrpc" != xyes; then 180 AC_CHECK_PROG([XMLRPC_C_CONFIG], [xmlrpc-c-config], [yes], [no]) 181 if test x"$XMLRPC_C_CONFIG" = xyes; then 182 XMLRPC_CFLAGS=$(xmlrpc-c-config client --cflags) 183 XMLRPC_LIBS=$(xmlrpc-c-config client --libs) 184 AC_SUBST(XMLRPC_CFLAGS) 185 AC_SUBST(XMLRPC_LIBS) 186 else 187 AC_MSG_ERROR([Failed to find xmlrpc, required by chamelium.]) 188 fi 189 fi 190 if test x"$gsl" != xyes; then 191 AC_MSG_ERROR([Failed to find gsl, required by chamelium.]) 192 fi 193 if test x"$alsa" != xyes; then 194 AC_MSG_ERROR([Failed to find alsa, required by chamelium.]) 195 fi 196 197 AC_DEFINE(HAVE_CHAMELIUM, 1, [Enable Chamelium support]) 198fi 199 200# ----------------------------------------------------------------------------- 201# Configuration options 202# ----------------------------------------------------------------------------- 203AC_ARG_ENABLE(intel, AS_HELP_STRING([--disable-intel], 204 [Enable building of intel specific parts (default: auto)]), 205 [INTEL=$enableval], [INTEL=auto]) 206if test "x$INTEL" = xauto; then 207 PKG_CHECK_EXISTS([libdrm_intel >= 2.4.75], [INTEL=yes], [INTEL=no]) 208fi 209if test "x$INTEL" = xyes; then 210 PKG_CHECK_MODULES(DRM_INTEL, [libdrm_intel >= 2.4.75]) 211 AC_DEFINE(HAVE_LIBDRM_INTEL, 1, [Have intel support]) 212else 213 DRM_INTEL_CFLAGS=-I$\(top_srcdir\)/lib/stubs/drm/ 214 DRM_INTEL_LIBS= 215fi 216DRM_CFLAGS="$DRM_CFLAGS $DRM_INTEL_CFLAGS" 217DRM_LIBS="$DRM_LIBS $DRM_INTEL_LIBS" 218AC_SUBST([DRM_CFLAGS]) 219AC_SUBST([DRM_LIBS]) 220 221AM_CONDITIONAL(HAVE_LIBDRM_INTEL, [test "x$INTEL" = xyes]) 222 223AC_ARG_ENABLE(amdgpu, AS_HELP_STRING([--disable-amdgpu], 224 [Enable building of amdgpu tests (default: auto)]), 225 [AMDGPU=$enableval], [AMDGPU=auto]) 226if test "x$AMDGPU" = xauto; then 227 PKG_CHECK_EXISTS([libdrm_amdgpu >= 2.4.81], [AMDGPU=yes], [AMDGPU=no]) 228fi 229if test "x$AMDGPU" = xyes; then 230 PKG_CHECK_MODULES(DRM_AMDGPU, [libdrm_amdgpu >= 2.4.81]) 231 AC_DEFINE(HAVE_LIBDRM_AMDGPU, 1, [Have amdgpu support]) 232fi 233AM_CONDITIONAL(HAVE_LIBDRM_AMDGPU, [test "x$AMDGPU" = xyes]) 234 235# for dma-buf tests 236AC_ARG_ENABLE(nouveau, AS_HELP_STRING([--disable-nouveau], 237 [Enable use of nouveau API for prime tests (default: auto)]), 238 [NOUVEAU=$enableval], [NOUVEAU=auto]) 239if test "x$NOUVEAU" = xauto; then 240 PKG_CHECK_EXISTS([libdrm_nouveau >= 2.4.33], [NOUVEAU=yes], [NOUVEAU=no]) 241fi 242if test "x$NOUVEAU" = xyes; then 243 PKG_CHECK_MODULES(DRM_NOUVEAU, [libdrm_nouveau >= 2.4.33]) 244 AC_DEFINE(HAVE_LIBDRM_NOUVEAU, 1, [Have nouveau support]) 245fi 246AM_CONDITIONAL(HAVE_LIBDRM_NOUVEAU, [test "x$NOUVEAU" = xyes]) 247 248# enable debug symbols 249AC_ARG_ENABLE(debug, 250 AS_HELP_STRING([--disable-debug], 251 [Build tests without debug symbols]), 252 [], [enable_debug=yes]) 253 254AC_ARG_ENABLE(werror, 255 AS_HELP_STRING([--enable-werror], 256 [Fail on warnings]), 257 [], [enable_werror=no]) 258 259# disable "warning: pointer of type ‘void *’ used in arithmetic" 260AS_COMPILER_FLAG([-Wno-pointer-arith], [CWARNFLAGS+=" -Wno-pointer-arith"], []) 261 262if test "x$enable_debug" = xyes; then 263 AS_COMPILER_FLAG([-g3], [DEBUG_CFLAGS="-g3"], [DEBUG_CFLAGS="-g"]) 264 AS_COMPILER_FLAG([-Og], [DEBUG_CFLAGS+=" -Og -Wno-maybe-uninitialized"], # disable maybe-uninitialized due to false positives 265 [DEBUG_CFLAGS+=" -O0"]) 266 AC_SUBST([DEBUG_CFLAGS]) 267fi 268 269if test "x$enable_werror" = xyes; then 270 AS_COMPILER_FLAG([-Werror], [WERROR_CFLAGS="-Werror"]) 271fi 272 273# prevent relinking the world on every commit for developers 274AC_ARG_ENABLE(git-hash, 275 AS_HELP_STRING([--disable-git-hash], 276 [Do not use git hash in version]), 277 [git_hash=$enableval], [git_hash=yes]) 278AC_SUBST(GIT_HASH, [$git_hash]) 279 280# ----------------------------------------------------------------------------- 281 282# To build multithread code, gcc uses -pthread, Solaris Studio cc uses -mt 283XORG_TESTSET_CFLAG([THREAD_CFLAGS], [-pthread], [-mt]) 284AC_SUBST([THREAD_CFLAGS]) 285 286AC_ARG_ENABLE(tests, 287 AS_HELP_STRING([--disable-tests], 288 [Disable tests build (default: enabled)]), 289 [BUILD_TESTS=$enableval], [BUILD_TESTS="yes"]) 290if test "x$BUILD_TESTS" = xyes; then 291 AC_DEFINE(BUILD_TESTS, 1, [Build tests]) 292fi 293AM_CONDITIONAL(BUILD_TESTS, [test "x$BUILD_TESTS" = xyes]) 294AC_DEFINE_UNQUOTED(TARGET_CPU_PLATFORM, ["$host_cpu"], [Target platform]) 295 296files="broadwell cherryview haswell ivybridge sandybridge valleyview skylake" 297for file in $files; do 298 REGISTER_FILES="$REGISTER_FILES $file `cat $srcdir/tools/registers/$file`" 299done 300REGISTER_FILES=`echo $REGISTER_FILES | tr ' ' '\n' | sort -u | tr '\n' ' '` 301AC_SUBST(REGISTER_FILES) 302 303AC_CONFIG_FILES([ 304 Makefile 305 benchmarks/Makefile 306 lib/Makefile 307 scripts/Makefile 308 tests/Makefile 309 tests/intel-ci/Makefile 310 tools/Makefile 311 tools/null_state_gen/Makefile 312 tools/registers/Makefile 313 overlay/Makefile 314 ]) 315 316AC_CONFIG_FILES([tools/intel_aubdump], [chmod +x tools/intel_aubdump]) 317 318AC_OUTPUT 319 320# Print a summary of the compilation 321echo "" 322echo "Intel GPU tools" 323 324echo "" 325echo " • Tests:" 326echo " Build tests : ${BUILD_TESTS}" 327echo " Chamelium tests : ${enable_chamelium}" 328echo " Compile prime tests: ${NOUVEAU}" 329echo " Debug flags : ${DEBUG_CFLAGS}" 330echo "" 331echo " • Tools:" 332echo " Overlay : X: ${enable_overlay_xlib}, Xv: ${enable_overlay_xvlib}" 333echo " x86-specific tools : ${build_x86}" 334echo " Test runner : ${BUILD_RUNNER}" 335echo "" 336echo " • Fail on warnings : ${enable_werror}" 337echo "" 338echo " WARNING: automake is deprecated, please use meson" 339echo "" 340 341# vim: set ft=config ts=8 sw=8 tw=0 noet : 342