igt_kms: don't get drmModeRes just to free it later
[platform/upstream/intel-gpu-tools.git] / configure.ac
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 AC_PREREQ([2.60])
24 AC_INIT([intel-gpu-tools],
25         [1.7],
26         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
27         [intel-gpu-tools])
28
29 AC_CONFIG_SRCDIR([Makefile.am])
30 AC_CONFIG_HEADERS([config.h])
31 AC_CONFIG_MACRO_DIR([m4])
32 AC_CONFIG_AUX_DIR([build-aux])
33 AC_USE_SYSTEM_EXTENSIONS
34 AC_SYS_LARGEFILE
35 AC_GNU_SOURCE
36 AC_CANONICAL_HOST
37
38 AM_INIT_AUTOMAKE([foreign dist-bzip2])
39 AM_PATH_PYTHON([3],, [:])
40
41 AC_PROG_CC
42 AM_PROG_LEX
43 AC_PROG_YACC
44
45 # check for gtk-doc
46 m4_ifdef([GTK_DOC_CHECK], [
47 GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
48 ],[
49 AM_CONDITIONAL([ENABLE_GTK_DOC], false)
50 enable_gtk_doc=no
51 ])
52
53
54 # Checks for functions, headers, structures, etc.
55 AC_HEADER_STDC
56 AC_CHECK_HEADERS([termios.h])
57 AC_CHECK_MEMBERS([struct sysinfo.totalram],[],[],[AC_INCLUDES_DEFAULT
58                   #include <sys/sysinfo.h>
59                   ])
60 AC_CHECK_FUNCS([swapctl])
61 AC_CHECK_FUNCS([asprintf])
62
63 # Initialize libtool
64 AC_DISABLE_STATIC
65 AC_PROG_LIBTOOL
66
67 # Require X.Org macros 1.16 or later for XORG_TESTSET_CFLAG
68 m4_ifndef([XORG_MACROS_VERSION],
69           [m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])])
70 XORG_MACROS_VERSION(1.16)
71 XORG_DEFAULT_OPTIONS
72
73 # warning flags for the assembler. We can't quite use CWARNFLAGS for it yet as
74 # it generates waaaay too many warnings.
75 ASSEMBLER_WARN_CFLAGS=""
76 if test "x$GCC" = "xyes"; then
77         ASSEMBLER_WARN_CFLAGS="-Wall -Wstrict-prototypes \
78         -Wmissing-prototypes -Wmissing-declarations \
79         -Wnested-externs -fno-strict-aliasing"
80 fi
81 AC_SUBST(ASSEMBLER_WARN_CFLAGS)
82
83 PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.52 libdrm])
84 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
85 PKG_CHECK_MODULES(OVERLAY_XVLIB, [xv x11 xext dri2proto >= 2.6], enable_overlay_xvlib=yes, enable_overlay_xvlib=no)
86 PKG_CHECK_MODULES(OVERLAY_XLIB, [cairo-xlib dri2proto >= 2.6], enable_overlay_xlib=yes, enable_overlay_xlib=no)
87
88 AM_CONDITIONAL(BUILD_OVERLAY_XVLIB, [test "x$enable_overlay_xvlib" = xyes])
89 AM_CONDITIONAL(BUILD_OVERLAY_XLIB, [test "x$enable_overlay_xlib" = xyes])
90 AM_CONDITIONAL(BUILD_OVERLAY, [test "x$enable_overlay_xlib" = xyes -o "x$enable_overlay_xvlib"])
91 if test x$enable_overlay_xvlib = xyes; then
92         AC_DEFINE(HAVE_OVERLAY_XVLIB, 1, [Enable XV backend])
93 fi
94 if test x$enable_overlay_xlib = xyes; then
95         AC_DEFINE(HAVE_OVERLAY_XLIB, 1, [Enable X backend])
96 fi
97 PKG_CHECK_MODULES(XRANDR, xrandr >= 1.3, AC_DEFINE(HAVE_XRANDR, 1, [Have libXrandr]), [have_xrandr=no])
98
99 # for testdisplay
100 PKG_CHECK_MODULES(CAIRO, [cairo >= 1.12.0])
101 PKG_CHECK_MODULES(LIBUDEV, [libudev], [udev=yes], [udev=no])
102 if test x"$udev" = xyes; then
103         AC_DEFINE(HAVE_UDEV,1,[Enable udev-based monitor hotplug detection])
104 fi
105 PKG_CHECK_MODULES(GLIB, glib-2.0)
106
107 # can we build the assembler?
108 AS_IF([test x"$LEX" != "x:" -a x"$YACC" != xyacc],
109       [enable_assembler=yes],
110       [enable_assembler=no])
111 AM_CONDITIONAL(BUILD_ASSEMBLER, [test "x$enable_assembler" = xyes])
112
113 # -----------------------------------------------------------------------------
114 #                       Configuration options
115 # -----------------------------------------------------------------------------
116 # for dma-buf tests
117 AC_ARG_ENABLE(nouveau, AS_HELP_STRING([--disable-nouveau],
118               [Enable use of nouveau API for prime tests (default: auto)]),
119               [NOUVEAU=$enableval], [NOUVEAU=auto])
120 if test "x$NOUVEAU" = xauto; then
121         PKG_CHECK_EXISTS([libdrm_nouveau >= 2.4.33], [NOUVEAU=yes], [NOUVEAU=no])
122 fi
123 if test "x$NOUVEAU" = xyes; then
124         PKG_CHECK_MODULES(DRM_NOUVEAU, [libdrm_nouveau >= 2.4.33])
125         AC_DEFINE(HAVE_NOUVEAU, 1, [Have nouveau support])
126 fi
127 AM_CONDITIONAL(HAVE_NOUVEAU, [test "x$NOUVEAU" = xyes])
128
129 #Configure options for the python quick-dumper
130 AC_ARG_ENABLE(dumper,
131               AS_HELP_STRING([--disable-dumper],
132                              [Disable the python based register dumper (default: enabled)]),
133                              [DUMPER=$enableval], [DUMPER=auto])
134 if test "x$DUMPER" = xauto; then
135         # AX_PYTHON_DEVEL/AX_SWIG_PYTHON are not super friendly and don't
136         # easily allow us to introspect the result of their checks. So if we
137         # find SWING on the system, that's enough to try compiling the dumper.
138         AX_PKG_SWIG(2.0.0, [DUMPER=yes], [DUMPER=no])
139 fi
140 if test "x$DUMPER" == xyes; then
141         AC_DEFINE(HAVE_DUMPER, 1, [Have dumper support])
142         # SWIG configuration
143         AX_PKG_SWIG(2.0.0, [], [ AC_MSG_ERROR([SWIG 2.0.0 or higher is required to build..]) ])
144         AX_PYTHON_DEVEL([>= '3.0'])
145         AX_SWIG_PYTHON
146 fi
147 AM_CONDITIONAL(HAVE_DUMPER, [test "x$DUMPER" = xyes])
148
149 # Define a configure option for the shader debugger
150 AC_ARG_ENABLE(shader-debugger, AS_HELP_STRING([--enable-shader-debugger],
151               [Enable shader debugging support [autodetected]]),
152               [BUILD_SHADER_DEBUGGER="$enableval"], [BUILD_SHADER_DEBUGGER=auto])
153
154 # Shader debugger depends on python3, intel-genasm and objcopy
155 if test "x$BUILD_SHADER_DEBUGGER" != xno; then
156         # Check that the assembler is built
157         if test "x$enable_assembler" = xno; then
158                 BUILD_SHADER_DEBUGGER=no
159                 if test "x$BUILD_SHADER_DEBUGGER" = xyes; then
160                         AC_MSG_ERROR([Shader debugger requested, but assembler not enabled.])
161                 fi
162         fi
163
164         # Check Python 3 is installed
165         if test "$PYTHON" = ":" ; then
166                 if test "x$BUILD_SHADER_DEBUGGER" = xyes; then
167                         AC_MSG_ERROR([Shader debugger requested, python version 3 not found.])
168                 else
169                         BUILD_SHADER_DEBUGGER=no
170                 fi
171         fi
172
173         # Check for the objcopy GNU binary utiliy command
174         AC_PATH_PROGS([OBJCOPY], objcopy)
175         if test -z "$OBJCOPY" ; then
176                 if test "x$BUILD_SHADER_DEBUGGER" = xyes; then
177                         AC_MSG_ERROR([Shader debugger requested, but objcopy command not found.])
178                 else
179                         BUILD_SHADER_DEBUGGER=no
180                 fi
181         fi
182 fi
183
184 AM_CONDITIONAL(BUILD_SHADER_DEBUGGER, [test "x$BUILD_SHADER_DEBUGGER" != xno])
185 AS_IF([test "x$BUILD_SHADER_DEBUGGER" != xno],
186       [enable_debugger=yes], [enable_debugger=no])
187
188 # -----------------------------------------------------------------------------
189
190 # To build multithread code, gcc uses -pthread, Solaris Studio cc uses -mt
191 XORG_TESTSET_CFLAG([THREAD_CFLAGS], [-pthread], [-mt])
192 AC_SUBST([THREAD_CFLAGS])
193
194 AC_ARG_ENABLE(tests,
195               AS_HELP_STRING([--disable-tests],
196               [Disable tests build (default: enabled)]),
197               [BUILD_TESTS=$enableval], [BUILD_TESTS="yes"])
198 if test "x$BUILD_TESTS" = xyes; then
199         AC_DEFINE(BUILD_TESTS, 1, [Build tests])
200 fi
201 AM_CONDITIONAL(BUILD_TESTS, [test "x$BUILD_TESTS" = xyes])
202 AC_DEFINE_UNQUOTED(TARGET_CPU_PLATFORM, ["$host_cpu"], [Target platform])
203
204 files="broadwell cherryview haswell ivybridge sandybridge valleyview"
205 for file in $files; do
206         QUICK_DUMP_EXTRA_DIST+="$file `tr '\n' ' ' < tools/quick_dump/$file`"
207 done
208 AC_SUBST(QUICK_DUMP_EXTRA_DIST)
209
210 AC_CONFIG_FILES([
211                  Makefile
212                  benchmarks/Makefile
213                  demos/Makefile
214                  docs/Makefile
215                  docs/reference/Makefile
216                  docs/reference/intel-gpu-tools/Makefile
217                  docs/reference/intel-gpu-tools/version.xml
218                  lib/Makefile
219                  man/Makefile
220                  scripts/Makefile
221                  tests/Makefile
222                  tools/Makefile
223                  tools/quick_dump/Makefile
224                  tools/null_state_gen/Makefile
225                  debugger/Makefile
226                  debugger/system_routine/Makefile
227                  assembler/Makefile
228                  assembler/doc/Makefile
229                  assembler/test/Makefile
230                  assembler/intel-gen4asm.pc
231                  overlay/Makefile
232                  ])
233 AC_OUTPUT
234
235 # Print a summary of the compilation
236 echo ""
237 echo "Intel GPU tools"
238
239 echo ""
240 echo " • Tests:"
241 echo "       Build tests        : ${BUILD_TESTS}"
242 echo "       Compile prime tests: ${NOUVEAU}"
243 echo ""
244 echo " • Tools:"
245 echo "       Assembler          : ${enable_assembler}"
246 echo "       Debugger           : ${enable_debugger}"
247 echo "       Python dumper      : ${DUMPER}"
248 echo "       Overlay            : X: ${enable_overlay_xlib}, Xv: ${enable_overlay_xvlib}"
249 echo ""
250 echo " • API-Documentation      : ${enable_gtk_doc}"
251 echo ""
252
253 # vim: set ft=config ts=8 sw=8 tw=0 noet :