configure.ac: require dri2proto for overlay
[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.4],
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
37 AM_INIT_AUTOMAKE([foreign dist-bzip2])
38 AM_PATH_PYTHON([3],, [:])
39
40 AC_PROG_CC
41 AM_PROG_LEX
42 AC_PROG_YACC
43
44 # Checks for functions, headers, structures, etc.
45 AC_HEADER_STDC
46 AC_CHECK_HEADERS([termios.h])
47 AC_CHECK_MEMBERS([struct sysinfo.totalram],[],[],[AC_INCLUDES_DEFAULT
48                   #include <sys/sysinfo.h>
49                   ])
50 AC_CHECK_FUNCS([swapctl])
51 AC_CHECK_FUNCS([asprintf])
52
53 # Initialize libtool
54 AC_DISABLE_STATIC
55 AC_PROG_LIBTOOL
56
57 # Require X.Org macros 1.16 or later for XORG_TESTSET_CFLAG
58 m4_ifndef([XORG_MACROS_VERSION],
59           [m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])])
60 XORG_MACROS_VERSION(1.16)
61 XORG_DEFAULT_OPTIONS
62
63 # warning flags for the assembler. We can't quite use CWARNFLAGS for it yet as
64 # it generates waaaay too many warnings.
65 ASSEMBLER_WARN_CFLAGS=""
66 if test "x$GCC" = "xyes"; then
67         ASSEMBLER_WARN_CFLAGS="-Wall -Wstrict-prototypes \
68         -Wmissing-prototypes -Wmissing-declarations \
69         -Wnested-externs -fno-strict-aliasing"
70 fi
71 AC_SUBST(ASSEMBLER_WARN_CFLAGS)
72
73 PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.40 libdrm])
74 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
75 PKG_CHECK_MODULES(OVERLAY_XVLIB, [xv x11 xext], enable_overlay_xvlib=yes, enable_overlay_xvlib=no)
76 PKG_CHECK_MODULES(OVERLAY_XLIB, [cairo-xlib], enable_overlay_xlib=yes, enable_overlay_xlib=no)
77
78 AM_CONDITIONAL(BUILD_OVERLAY_XVLIB, [test "x$enable_overlay_xvlib" = xyes])
79 AM_CONDITIONAL(BUILD_OVERLAY_XLIB, [test "x$enable_overlay_xlib" = xyes])
80 AM_CONDITIONAL(BUILD_OVERLAY, [test "x$enable_overlay_xlib" = xyes -o "x$enable_overlay_xvlib"])
81 if test x$enable_overlay_xvlib = xyes; then
82         AC_DEFINE(HAVE_OVERLAY_XVLIB, 1, [Enable XV backend])
83         PKG_CHECK_MODULES(DRI2PROTO, [dri2proto >= 2.6])
84 fi
85 if test x$enable_overlay_xlib = xyes; then
86         AC_DEFINE(HAVE_OVERLAY_XLIB, 1, [Enable X backend])
87         PKG_CHECK_MODULES(DRI2PROTO, [dri2proto >= 2.6])
88 fi
89 PKG_CHECK_MODULES(XRANDR, xrandr >= 1.3, AC_DEFINE(HAVE_XRANDR, 1, [Have libXrandr]), [have_xrandr=no])
90
91 # for testdisplay
92 PKG_CHECK_MODULES(CAIRO, [cairo >= 1.12.0])
93 PKG_CHECK_MODULES(LIBUDEV, [libudev], [udev=yes], [udev=no])
94 if test x"$udev" = xyes; then
95         AC_DEFINE(HAVE_UDEV,1,[Enable udev-based monitor hotplug detection])
96 fi
97 PKG_CHECK_MODULES(GLIB, glib-2.0)
98
99 # can we build the assembler?
100 AS_IF([test x"$LEX" != "x:" -a x"$YACC" != xyacc],
101       [enable_assembler=yes],
102       [enable_assembler=no])
103 AM_CONDITIONAL(BUILD_ASSEMBLER, [test "x$enable_assembler" = xyes])
104
105 # -----------------------------------------------------------------------------
106 #                       Configuration options
107 # -----------------------------------------------------------------------------
108 # for dma-buf tests
109 AC_ARG_ENABLE(nouveau, AS_HELP_STRING([--disable-nouveau],
110               [Enable use of nouveau API for prime tests (default: enabled)]),
111               [NOUVEAU=$enableval], [NOUVEAU=yes])
112 if test "x$NOUVEAU" = xyes; then
113         PKG_CHECK_MODULES(DRM_NOUVEAU, [libdrm_nouveau >= 2.4.33])
114         AC_DEFINE(HAVE_NOUVEAU, 1, [Have nouveau support])
115 fi
116 AM_CONDITIONAL(HAVE_NOUVEAU, [test "x$NOUVEAU" = xyes])
117
118 #Configure options for the python quick-dumper
119 AC_ARG_ENABLE(dumper,
120               AS_HELP_STRING([--disable-dumper],
121                              [Disable the python based register dumper (default: enabled)]),
122                              [DUMPER=$enableval], [DUMPER=yes])
123 if test "x$DUMPER" == xyes; then
124         AC_DEFINE(HAVE_DUMPER, 1, [Have dumper support])
125         # SWIG configuration
126         AX_PKG_SWIG(2.0.0, [], [ AC_MSG_ERROR([SWIG 2.0.0 or higher is required to build..]) ])
127         AX_PYTHON_DEVEL([>= '3.0'])
128         AX_SWIG_PYTHON
129 fi
130 AM_CONDITIONAL(HAVE_DUMPER, [test "x$DUMPER" = xyes])
131
132 # Define a configure option for the shadder debugger
133 AC_ARG_ENABLE(shader-debugger, AS_HELP_STRING([--enable-shader-debugger],
134               [Enable shader debugging support [autodetected]]),
135               [BUILD_SHADER_DEBUGGER="$enableval"], [BUILD_SHADER_DEBUGGER=auto])
136
137 # Shadder debugger depends on python3, intel-genasm and objcopy
138 if test "x$BUILD_SHADER_DEBUGGER" != xno; then
139         # Check Python 3 is installed
140         if test "$PYTHON" = ":" ; then
141                 if test "x$BUILD_SHADER_DEBUGGER" = xyes; then
142                         AC_MSG_ERROR([Shader debugger requested, python version 3 not found.])
143                 else
144                         BUILD_SHADER_DEBUGGER=no
145                 fi
146         fi
147         # Check for the Intel Chipset assembler compiler
148         AC_PATH_PROGS([GEN4ASM], intel-gen4asm)
149         if test -z "$GEN4ASM" ; then
150                 if test "x$BUILD_SHADER_DEBUGGER" = xyes; then
151                         AC_MSG_ERROR([Shader debugger requested, but intel-gen4asm not found.])
152                 else
153                         BUILD_SHADER_DEBUGGER=no
154                 fi
155         fi
156         # Check for the objcopy GNU binary utiliy command
157         AC_PATH_PROGS([OBJCOPY], objcopy)
158         if test -z "$OBJCOPY" ; then
159                 if test "x$BUILD_SHADER_DEBUGGER" = xyes; then
160                         AC_MSG_ERROR([Shader debugger requested, but objcopy command not found.])
161                 else
162                         BUILD_SHADER_DEBUGGER=no
163                 fi
164         fi
165 fi
166
167 AM_CONDITIONAL(BUILD_SHADER_DEBUGGER, [test "x$BUILD_SHADER_DEBUGGER" != xno])
168 AS_IF([test "x$BUILD_SHADER_DEBUGGER" != xno],
169       [enable_debugger=yes], [enable_debugger=no])
170
171 # -----------------------------------------------------------------------------
172
173 # To build multithread code, gcc uses -pthread, Solaris Studio cc uses -mt
174 XORG_TESTSET_CFLAG([THREAD_CFLAGS], [-pthread], [-mt])
175 AC_SUBST([THREAD_CFLAGS])
176
177 AC_ARG_ENABLE(tests,
178               AS_HELP_STRING([--disable-tests],
179               [Disable tests build (default: enabled)]),
180               [BUILD_TESTS=$enableval], [BUILD_TESTS="yes"])
181 if test "x$BUILD_TESTS" = xyes; then
182         AC_DEFINE(BUILD_TESTS, 1, [Build tests])
183 fi
184 AM_CONDITIONAL(BUILD_TESTS, [test "x$BUILD_TESTS" = xyes])
185
186 AC_CONFIG_FILES([
187                  Makefile
188                  benchmarks/Makefile
189                  demos/Makefile
190                  lib/Makefile
191                  man/Makefile
192                  scripts/Makefile
193                  tests/Makefile
194                  tools/Makefile
195                  tools/quick_dump/Makefile
196                  debugger/Makefile
197                  debugger/system_routine/Makefile
198                  assembler/Makefile
199                  assembler/doc/Makefile
200                  assembler/test/Makefile
201                  assembler/intel-gen4asm.pc
202                  overlay/Makefile
203                  ])
204 AC_OUTPUT
205
206 # Print a summary of the compilation
207 echo ""
208 echo "Intel GPU tools"
209
210 echo ""
211 echo " • Tests:"
212 echo "       Build tests        : ${BUILD_TESTS}"
213 echo "       Compile prime tests: ${NOUVEAU}"
214 echo ""
215 echo " • Tools:"
216 echo "       Assembler          : ${enable_assembler}"
217 echo "       Debugger           : ${enable_debugger}"
218 echo "       Python dumper      : ${DUMPER}"
219 echo "       Overlay            : X: ${enable_overlay_xlib}, Xv: ${enable_overlay_xvlib}"
220 echo ""
221
222 # vim: set ft=config ts=8 sw=8 tw=0 noet :