configure.ac 18.9 KB
Newer Older
Adam Jackson's avatar
Adam Jackson committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#  Copyright 2005 Adam Jackson.
#
#  Permission is hereby granted, free of charge, to any person obtaining a
#  copy of this software and associated documentation files (the "Software"),
#  to deal in the Software without restriction, including without limitation
#  on the rights to use, copy, modify, merge, publish, distribute, sub
#  license, and/or sell copies of the Software, and to permit persons to whom
#  the Software is furnished to do so, subject to the following conditions:
#
#  The above copyright notice and this permission notice (including the next
#  paragraph) shall be included in all copies or substantial portions of the
#  Software.
#
#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#  FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
#  ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
#  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

21
22
AC_PREREQ([2.63])
AC_INIT([libdrm],
Rob Clark's avatar
Rob Clark committed
23
        [2.4.91],
24
25
26
27
        [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI],
        [libdrm])

AC_CONFIG_HEADERS([config.h])
Adam Jackson's avatar
Adam Jackson committed
28
AC_CONFIG_SRCDIR([Makefile.am])
29
30
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
31
PKG_PROG_PKG_CONFIG
32

Emil Velikov's avatar
Emil Velikov committed
33
34
35
36
37
38
39
# Require xorg-macros minimum of 1.12 for XORG_WITH_XSLTPROC
m4_ifndef([XORG_MACROS_VERSION],
          [m4_fatal([must install xorg-macros 1.12 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.12)
XORG_WITH_XSLTPROC
XORG_MANPAGE_SECTIONS

40
AM_INIT_AUTOMAKE([1.10 foreign dist-bzip2])
Adam Jackson's avatar
Adam Jackson committed
41

42
43
# Enable quiet compiles on automake 1.11.
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Adam Jackson's avatar
Adam Jackson committed
44

45
# Check for programs
Adam Jackson's avatar
Adam Jackson committed
46
AC_PROG_CC
47
AC_PROG_CC_C99
48
AC_PROG_NM
49
50
51
52

if test "x$ac_cv_prog_cc_c99" = xno; then
	AC_MSG_ERROR([Building libdrm requires C99 enabled compiler])
fi
Adam Jackson's avatar
Adam Jackson committed
53

54
AC_USE_SYSTEM_EXTENSIONS
55
AC_SYS_LARGEFILE
56
AC_FUNC_ALLOCA
Adam Jackson's avatar
Adam Jackson committed
57

58
59
save_CFLAGS="$CFLAGS"
export CFLAGS="$CFLAGS -Werror"
60
AC_HEADER_MAJOR
61
62
CFLAGS="$save_CFLAGS"

63
AC_CHECK_HEADERS([sys/sysctl.h sys/select.h])
64

65
66
67
68
# Initialize libtool
LT_PREREQ([2.2])
LT_INIT([disable-static])

69
dnl pthread-stubs is mandatory on some BSD platforms, due to the nature of the
70
71
dnl project. Even then there's a notable issue as described in the project README
case "$host_os" in
72
linux* | cygwin* | darwin* | solaris* | *-gnu* | gnu* | openbsd*)
73
74
75
76
77
78
    pthread_stubs_possible="no"
    ;;
* )
    pthread_stubs_possible="yes"
    ;;
esac
Emma Anholt's avatar
Emma Anholt committed
79

80
81
82
83
84
if test "x$pthread_stubs_possible" = xyes; then
    PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs >= 0.4)
    AC_SUBST(PTHREADSTUBS_CFLAGS)
    AC_SUBST(PTHREADSTUBS_LIBS)
fi
85

Adam Jackson's avatar
Adam Jackson committed
86
pkgconfigdir=${libdir}/pkgconfig
Adam Jackson's avatar
Adam Jackson committed
87
AC_SUBST(pkgconfigdir)
88
89
90
libdrmdatadir=${datadir}/libdrm
AC_SUBST(libdrmdatadir)

91
92
93
94
AC_ARG_ENABLE([udev],
              [AS_HELP_STRING([--enable-udev],
                              [Enable support for using udev instead of mknod (default: disabled)])],
              [UDEV=$enableval], [UDEV=no])
Adam Jackson's avatar
Adam Jackson committed
95

Jakob Bornecrantz's avatar
Jakob Bornecrantz committed
96
AC_ARG_ENABLE(libkms,
Jakob Bornecrantz's avatar
Jakob Bornecrantz committed
97
	      AS_HELP_STRING([--disable-libkms],
98
	      [Disable KMS mm abstraction library (default: auto, enabled on supported platforms)]),
99
	      [LIBKMS=$enableval], [LIBKMS=auto])
Jakob Bornecrantz's avatar
Jakob Bornecrantz committed
100

101
102
AC_ARG_ENABLE(intel,
	      AS_HELP_STRING([--disable-intel],
103
	      [Enable support for intel's KMS API (default: auto, enabled on x86)]),
104
	      [INTEL=$enableval], [INTEL=auto])
105

106
107
AC_ARG_ENABLE(radeon,
	      AS_HELP_STRING([--disable-radeon],
108
109
	      [Enable support for radeon's KMS API (default: auto)]),
	      [RADEON=$enableval], [RADEON=auto])
110

Alex Deucher's avatar
Alex Deucher committed
111
112
113
114
115
AC_ARG_ENABLE(amdgpu,
	      AS_HELP_STRING([--disable-amdgpu],
	      [Enable support for amdgpu's KMS API (default: auto)]),
	      [AMDGPU=$enableval], [AMDGPU=auto])

116
117
118
119
120
AC_ARG_ENABLE(nouveau,
	      AS_HELP_STRING([--disable-nouveau],
	      [Enable support for nouveau's KMS API (default: auto)]),
	      [NOUVEAU=$enableval], [NOUVEAU=auto])

121
122
123
124
AC_ARG_ENABLE(vmwgfx,
	      AS_HELP_STRING([--disable-vmwgfx],
	      [Enable support for vmwgfx's KMS API (default: yes)]),
	      [VMWGFX=$enableval], [VMWGFX=yes])
125

Rob Clark's avatar
Rob Clark committed
126
127
128
129
AC_ARG_ENABLE(omap-experimental-api,
	      AS_HELP_STRING([--enable-omap-experimental-api],
	      [Enable support for OMAP's experimental API (default: disabled)]),
	      [OMAP=$enableval], [OMAP=no])
130

Inki Dae's avatar
Inki Dae committed
131
132
133
134
135
AC_ARG_ENABLE(exynos-experimental-api,
	      AS_HELP_STRING([--enable-exynos-experimental-api],
	      [Enable support for EXYNOS's experimental API (default: disabled)]),
	      [EXYNOS=$enableval], [EXYNOS=no])

136
137
AC_ARG_ENABLE(freedreno,
	      AS_HELP_STRING([--disable-freedreno],
Emil Velikov's avatar
Emil Velikov committed
138
	      [Enable support for freedreno's KMS API (default: auto, enabled on arm)]),
139
	      [FREEDRENO=$enableval], [FREEDRENO=auto])
Rob Clark's avatar
Rob Clark committed
140

141
142
143
144
145
AC_ARG_ENABLE(freedreno-kgsl,
	      AS_HELP_STRING([--enable-freedreno-kgsl],
	      [Enable support for freedreno's to use downstream android kernel API (default: disabled)]),
	      [FREEDRENO_KGSL=$enableval], [FREEDRENO_KGSL=no])

146
147
148
149
150
AC_ARG_ENABLE(tegra-experimental-api,
	      AS_HELP_STRING([--enable-tegra-experimental-api],
	      [Enable support for Tegra's experimental API (default: disabled)]),
	      [TEGRA=$enableval], [TEGRA=no])

151
152
153
154
155
AC_ARG_ENABLE(vc4,
	      AS_HELP_STRING([--disable-vc4],
	      [Enable support for vc4's API (default: auto, enabled on arm)]),
	      [VC4=$enableval], [VC4=auto])

156
157
158
159
160
AC_ARG_ENABLE(etnaviv-experimental-api,
	      AS_HELP_STRING([--enable-etnaviv-experimental-api],
	      [Enable support for etnaviv's experimental API (default: disabled)]),
	      [ETNAVIV=$enableval], [ETNAVIV=no])

161
162
163
164
165
AC_ARG_ENABLE(install-test-programs,
		  AS_HELP_STRING([--enable-install-test-programs],
		  [Install test programs (default: no)]),
		  [INSTALL_TESTS=$enableval], [INSTALL_TESTS=no])

166
167
168
169
170
171
172
173
dnl ===========================================================================
dnl check compiler flags
AC_DEFUN([LIBDRM_CC_TRY_FLAG], [
  AC_MSG_CHECKING([whether $CC supports $1])

  libdrm_save_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS $1"

174
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([ ])], [libdrm_cc_flag=yes], [libdrm_cc_flag=no])
175
176
177
178
179
180
181
182
183
184
  CFLAGS="$libdrm_save_CFLAGS"

  if test "x$libdrm_cc_flag" = "xyes"; then
    ifelse([$2], , :, [$2])
  else
    ifelse([$3], , :, [$3])
  fi
  AC_MSG_RESULT([$libdrm_cc_flag])
])

185
186
187
188
189
190
191
dnl We use clock_gettime to check for timeouts in drmWaitVBlank

AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
               [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt],
                             [AC_MSG_ERROR([Couldn't find clock_gettime])])])
AC_SUBST([CLOCK_LIB])

192
193
194
AC_CHECK_FUNCS([open_memstream],
               [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 1, [Have open_memstream()])],
               [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 0)])
195

196
197
198
199
200
201
202
dnl Use lots of warning flags with with gcc and compatible compilers

dnl Note: if you change the following variable, the cache is automatically
dnl skipped and all flags rechecked.  So there's no need to do anything
dnl else.  If for any reason you need to force a recheck, just change
dnl MAYBE_WARN in an ignorable way (like adding whitespace)

203
MAYBE_WARN="-Wall -Wextra -Werror=undef \
204
205
206
207
-Wsign-compare -Werror-implicit-function-declaration \
-Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
-Wpacked -Wswitch-enum -Wmissing-format-attribute \
208
-Wstrict-aliasing=2 -Winit-self \
209
-Wdeclaration-after-statement -Wold-style-definition \
210
-Wno-unused-parameter \
211
212
-Wno-attributes -Wno-long-long -Winline -Wshadow \
-Wno-missing-field-initializers"
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242

# invalidate cached value if MAYBE_WARN has changed
if test "x$libdrm_cv_warn_maybe" != "x$MAYBE_WARN"; then
	unset libdrm_cv_warn_cflags
fi
AC_CACHE_CHECK([for supported warning flags], libdrm_cv_warn_cflags, [
	echo
	WARN_CFLAGS=""

	# Some warning options are not supported by all versions of
	# gcc, so test all desired options against the current
	# compiler.
	#
	# Note that there are some order dependencies
	# here. Specifically, an option that disables a warning will
	# have no net effect if a later option then enables that
	# warnings, (perhaps implicitly). So we put some grouped
	# options (-Wall and -Wextra) up front and the -Wno options
	# last.

	for W in $MAYBE_WARN; do
		LIBDRM_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
	done

	libdrm_cv_warn_cflags=$WARN_CFLAGS
	libdrm_cv_warn_maybe=$MAYBE_WARN

	AC_MSG_CHECKING([which warning flags were supported])])
WARN_CFLAGS="$libdrm_cv_warn_cflags"

243
244
245
246
247
# Check for atomic intrinsics
AC_CACHE_CHECK([for native atomic primitives], drm_cv_atomic_primitives, [
	drm_cv_atomic_primitives="none"

	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
248
	int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
249
	int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
					  ]],[[]])], [drm_cv_atomic_primitives="Intel"],[])

	if test "x$drm_cv_atomic_primitives" = "xnone"; then
		AC_CHECK_HEADER([atomic_ops.h], drm_cv_atomic_primitives="libatomic-ops")
	fi

	# atomic functions defined in <atomic.h> & libc on Solaris
	if test "x$drm_cv_atomic_primitives" = "xnone"; then
		AC_CHECK_FUNC([atomic_cas_uint], drm_cv_atomic_primitives="Solaris")
	fi
])

if test "x$drm_cv_atomic_primitives" = xIntel; then
	AC_DEFINE(HAVE_LIBDRM_ATOMIC_PRIMITIVES, 1,
		[Enable if your compiler supports the Intel __sync_* atomic primitives])
265
266
else
	AC_DEFINE(HAVE_LIBDRM_ATOMIC_PRIMITIVES, 0)
267
268
269
fi
if test "x$drm_cv_atomic_primitives" = "xlibatomic-ops"; then
	AC_DEFINE(HAVE_LIB_ATOMIC_OPS, 1, [Enable if you have libatomic-ops-dev installed])
270
271
else
	AC_DEFINE(HAVE_LIB_ATOMIC_OPS, 0)
272
273
fi

274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
dnl Print out the approapriate message considering the value set be the
dnl respective in $1.
dnl $1 - value to be evaluated. Eg. $INTEL, $NOUVEAU, ...
dnl $2 - libdrm shortname. Eg. intel, freedreno, ...
dnl $3 - GPU name/brand. Eg. Intel, NVIDIA Tegra, ...
dnl $4 - Configure switch. Eg. intel, omap-experimental-api, ...
AC_DEFUN([LIBDRM_ATOMICS_NOT_FOUND_MSG], [
	case "x$1" in
		xyes)	AC_MSG_ERROR([libdrm_$2 depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for $3 GPUs by passing --disable-$4 to ./configure]) ;;
		xauto)	AC_MSG_WARN([Disabling $2. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) ;;
		*)	;;
	esac
])

if test "x$drm_cv_atomic_primitives" = "xnone"; then
	LIBDRM_ATOMICS_NOT_FOUND_MSG($INTEL, intel, Intel, intel)
	INTEL=no

	LIBDRM_ATOMICS_NOT_FOUND_MSG($RADEON, radeon, Radeon, radeon)
	RADEON=no

Alex Deucher's avatar
Alex Deucher committed
295
296
297
	LIBDRM_ATOMICS_NOT_FOUND_MSG($AMDGPU, amdgpu, AMD, amdgpu)
	AMDGPU=no

298
299
300
301
302
303
304
305
306
307
308
	LIBDRM_ATOMICS_NOT_FOUND_MSG($NOUVEAU, nouveau, NVIDIA, nouveau)
	NOUVEAU=no

	LIBDRM_ATOMICS_NOT_FOUND_MSG($OMAP, omap, OMAP, omap-experimental-api)
	OMAP=no

	LIBDRM_ATOMICS_NOT_FOUND_MSG($FREEDRENO, freedreno, Qualcomm Adreno, freedreno)
	FREEDRENO=no

	LIBDRM_ATOMICS_NOT_FOUND_MSG($TEGRA, tegra, NVIDIA Tegra, tegra-experimental-api)
	TEGRA=no
309
310
311

	LIBDRM_ATOMICS_NOT_FOUND_MSG($ETNAVIV, etnaviv, Vivante, etnaviv-experimental-api)
	ETNAVIV=no
312
313
314
315
316
317
318
319
320
321
else
	if test "x$INTEL" = xauto; then
		case $host_cpu in
			i?86|x86_64)	INTEL=yes ;;
			*)		INTEL=no ;;
		esac
	fi
	if test "x$RADEON" = xauto; then
		RADEON=yes
	fi
Alex Deucher's avatar
Alex Deucher committed
322
323
324
	if test "x$AMDGPU" = xauto; then
		AMDGPU=yes
	fi
325
326
327
328
329
330
331
332
	if test "x$NOUVEAU" = xauto; then
		NOUVEAU=yes
	fi
	if test "x$FREEDRENO" = xauto; then
		case $host_cpu in
			arm*|aarch64)	FREEDRENO=yes ;;
			*)		FREEDRENO=no ;;
		esac
333
	fi
334
335
336
337
338
339
	if test "x$VC4" = xauto; then
		case $host_cpu in
			arm*|aarch64)	VC4=yes ;;
			*)		VC4=no ;;
		esac
	fi
340
341
342
343
344
345
346
347
fi

if test "x$INTEL" != "xno"; then
	PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
fi
AC_SUBST(PCIACCESS_CFLAGS)
AC_SUBST(PCIACCESS_LIBS)

Dave Airlie's avatar
Dave Airlie committed
348
349
350
351
if test "x$UDEV" = xyes; then
	AC_DEFINE(UDEV, 1, [Have UDEV support])
fi

352
353
354
355
AC_CANONICAL_HOST
if test "x$LIBKMS" = xauto ; then
	case $host_os in
		linux*)		LIBKMS="yes" ;;
356
357
		freebsd* | kfreebsd*-gnu)
				LIBKMS="yes" ;;
358
		dragonfly*)	LIBKMS="yes" ;;
359
360
361
362
		*)		LIBKMS="no" ;;
	esac
fi

Jakob Bornecrantz's avatar
Jakob Bornecrantz committed
363
364
AM_CONDITIONAL(HAVE_LIBKMS, [test "x$LIBKMS" = xyes])

365
AM_CONDITIONAL(HAVE_INTEL, [test "x$INTEL" = xyes])
366
367
if test "x$INTEL" = xyes; then
	AC_DEFINE(HAVE_INTEL, 1, [Have intel support])
368
369
else
	AC_DEFINE(HAVE_INTEL, 0)
370
fi
371

372
AM_CONDITIONAL(HAVE_VMWGFX, [test "x$VMWGFX" = xyes])
373
374
if test "x$VMWGFX" = xyes; then
	AC_DEFINE(HAVE_VMWGFX, 1, [Have vmwgfx kernel headers])
375
376
else
	AC_DEFINE(HAVE_VMWGFX, 0)
377
fi
378

379
AM_CONDITIONAL(HAVE_NOUVEAU, [test "x$NOUVEAU" = xyes])
380
381
if test "x$NOUVEAU" = xyes; then
	AC_DEFINE(HAVE_NOUVEAU, 1, [Have nouveau (nvidia) support])
382
383
else
	AC_DEFINE(HAVE_NOUVEAU, 0)
384
fi
385

Rob Clark's avatar
Rob Clark committed
386
387
AM_CONDITIONAL(HAVE_OMAP, [test "x$OMAP" = xyes])

Inki Dae's avatar
Inki Dae committed
388
389
390
AM_CONDITIONAL(HAVE_EXYNOS, [test "x$EXYNOS" = xyes])
if test "x$EXYNOS" = xyes; then
	AC_DEFINE(HAVE_EXYNOS, 1, [Have EXYNOS support])
391
392
else
	AC_DEFINE(HAVE_EXYNOS, 0)
Inki Dae's avatar
Inki Dae committed
393
394
fi

Rob Clark's avatar
Rob Clark committed
395
396
AM_CONDITIONAL(HAVE_FREEDRENO, [test "x$FREEDRENO" = xyes])

397
398
399
400
401
if test "x$FREEDRENO_KGSL" = xyes; then
	if test "x$FREEDRENO" != xyes; then
		AC_MSG_ERROR([Cannot enable freedreno KGSL interface if freedreno is disabled])
	fi
fi
402
403
404
AM_CONDITIONAL(HAVE_FREEDRENO_KGSL, [test "x$FREEDRENO_KGSL" = xyes])
if test "x$FREEDRENO_KGSL" = xyes; then
	AC_DEFINE(HAVE_FREEDRENO_KGSL, 1, [Have freedreno support for KGSL kernel interface])
405
406
else
	AC_DEFINE(HAVE_FREEDRENO_KGSL, 0)
407
408
fi

409
410
411
AM_CONDITIONAL(HAVE_RADEON, [test "x$RADEON" = xyes])
if test "x$RADEON" = xyes; then
	AC_DEFINE(HAVE_RADEON, 1, [Have radeon support])
412
413
else
	AC_DEFINE(HAVE_RADEON, 0)
414
415
fi

416
417
418
419
420
421
422
423
424
425
426
427
428
429
if test "x$AMDGPU" != xno; then
	# Detect cunit library
	PKG_CHECK_MODULES([CUNIT], [cunit >= 2.1], [have_cunit=yes], [have_cunit=no])
	# If pkg-config does not find cunit, check it using AC_CHECK_LIB.  We
	# do this because Debian (Ubuntu) lacks pkg-config file for cunit.
	# fixed in 2.1-2.dfsg-3: http://anonscm.debian.org/cgit/collab-maint/cunit.git/commit/?h=debian
	if test "x${have_cunit}" = "xno"; then
		AC_CHECK_LIB([cunit], [CU_initialize_registry], [have_cunit=yes], [have_cunit=no])
		if test "x${have_cunit}" = "xyes"; then
			CUNIT_LIBS="-lcunit"
			CUNIT_CFLAGS=""
			AC_SUBST([CUNIT_LIBS])
			AC_SUBST([CUNIT_CFLAGS])
		fi
430
	fi
431
432
else
	have_cunit=no
433
fi
434
AM_CONDITIONAL(HAVE_CUNIT, [test "x$have_cunit" != "xno"])
435

Alex Deucher's avatar
Alex Deucher committed
436
437
438
AM_CONDITIONAL(HAVE_AMDGPU, [test "x$AMDGPU" = xyes])
if test "x$AMDGPU" = xyes; then
	AC_DEFINE(HAVE_AMDGPU, 1, [Have amdgpu support])
Alex Deucher's avatar
Alex Deucher committed
439
440
441
442

	if test "x$have_cunit" = "xno"; then
		AC_MSG_WARN([Could not find cunit library. Disabling amdgpu tests])
	fi
443
444
else
	AC_DEFINE(HAVE_AMDGPU, 0)
Alex Deucher's avatar
Alex Deucher committed
445
446
fi

447
448
AM_CONDITIONAL(HAVE_TEGRA, [test "x$TEGRA" = xyes])

449
450
451
AM_CONDITIONAL(HAVE_VC4, [test "x$VC4" = xyes])
if test "x$VC4" = xyes; then
	AC_DEFINE(HAVE_VC4, 1, [Have VC4 support])
452
453
else
	AC_DEFINE(HAVE_VC4, 0)
454
455
fi

456
457
AM_CONDITIONAL(HAVE_ETNAVIV, [test "x$ETNAVIV" = xyes])

458
459
AM_CONDITIONAL(HAVE_INSTALL_TESTS, [test "x$INSTALL_TESTS" = xyes])

460
461
462
463
AC_ARG_ENABLE([cairo-tests],
              [AS_HELP_STRING([--enable-cairo-tests],
                              [Enable support for Cairo rendering in tests (default: auto)])],
              [CAIRO=$enableval], [CAIRO=auto])
464
465
466
if test "x$CAIRO" != xno; then
	PKG_CHECK_MODULES(CAIRO, cairo, [HAVE_CAIRO=yes], [HAVE_CAIRO=no])
fi
467
468
469
AC_MSG_CHECKING([whether to enable Cairo tests])
if test "x$CAIRO" = xauto; then
	CAIRO="$HAVE_CAIRO"
470
fi
471
472
473
474
475
if test "x$CAIRO" = xyes; then
	if ! test "x$HAVE_CAIRO" = xyes; then
		AC_MSG_ERROR([Cairo support required but not present])
	fi
	AC_DEFINE(HAVE_CAIRO, 1, [Have Cairo support])
Eric Engestrom's avatar
Eric Engestrom committed
476
477
else
	AC_DEFINE(HAVE_CAIRO, 0)
478
479
480
fi
AC_MSG_RESULT([$CAIRO])
AM_CONDITIONAL(HAVE_CAIRO, [test "x$CAIRO" = xyes])
481

482
483
# xsltproc for docbook manpages
AC_ARG_ENABLE([manpages],
Emil Velikov's avatar
Emil Velikov committed
484
              AS_HELP_STRING([--enable-manpages], [enable manpages @<:@default=auto@:>@]),
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
              [MANS=$enableval], [MANS=auto])
AM_CONDITIONAL([BUILD_MANPAGES], [test "x$XSLTPROC" != "x" -a "x$MANS" != "xno"])

# check for offline man-pages stylesheet
AC_MSG_CHECKING([for docbook manpages stylesheet])
MANPAGES_STYLESHEET="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
AC_PATH_PROGS_FEATURE_CHECK([XSLTPROC_TMP], [xsltproc],
                            AS_IF([`"$ac_path_XSLTPROC_TMP" --nonet "$MANPAGES_STYLESHEET" > /dev/null 2>&1`],
                                  [HAVE_MANPAGES_STYLESHEET=yes]))
if test "x$HAVE_MANPAGES_STYLESHEET" = "xyes"; then
        AC_SUBST(MANPAGES_STYLESHEET)
        AC_MSG_RESULT([yes])
else
        AC_MSG_RESULT([no])
fi
AM_CONDITIONAL([HAVE_MANPAGES_STYLESHEET], [test "x$HAVE_MANPAGES_STYLESHEET" = "xyes"])
501

502
503
504
AC_ARG_ENABLE(valgrind,
              [AS_HELP_STRING([--enable-valgrind],
                             [Build libdrm with  valgrind support (default: auto)])],
505
                             [VALGRIND=$enableval], [VALGRIND=auto])
506
507
508
if test "x$VALGRIND" != xno; then
	PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no])
fi
509
510
511
512
513
514
515
516
517
AC_MSG_CHECKING([whether to enable Valgrind support])
if test "x$VALGRIND" = xauto; then
	VALGRIND="$have_valgrind"
fi

if test "x$VALGRIND" = "xyes"; then
	if ! test "x$have_valgrind" = xyes; then
		AC_MSG_ERROR([Valgrind support required but not present])
	fi
518
	AC_DEFINE([HAVE_VALGRIND], 1, [Use valgrind intrinsics to suppress false warnings])
Eric Engestrom's avatar
Eric Engestrom committed
519
520
else
	AC_DEFINE([HAVE_VALGRIND], 0)
521
fi
522

523
524
AC_MSG_RESULT([$VALGRIND])

525
526
527
528
529
AC_ARG_WITH([kernel-source],
            [AS_HELP_STRING([--with-kernel-source],
              [specify path to linux kernel source])],
	    [kernel_source="$with_kernel_source"])
AC_SUBST(kernel_source)
530

Emil Velikov's avatar
Emil Velikov committed
531
AC_MSG_CHECKING([whether $CC supports __attribute__(("hidden"))])
532
533
534
AC_LINK_IFELSE([AC_LANG_PROGRAM([
    int foo_hidden( void ) __attribute__((visibility("hidden")));
])], HAVE_ATTRIBUTE_VISIBILITY="yes"; AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]));
535

536
if test "x$HAVE_ATTRIBUTE_VISIBILITY" = xyes; then
Emil Velikov's avatar
Emil Velikov committed
537
    AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler supports __attribute__(("hidden"))])
538
539
else
    AC_DEFINE(HAVE_VISIBILITY, 0)
540
541
fi

542
AC_SUBST(WARN_CFLAGS)
543
AC_CONFIG_FILES([
544
	Makefile
545
	data/Makefile
Jakob Bornecrantz's avatar
Jakob Bornecrantz committed
546
547
	libkms/Makefile
	libkms/libkms.pc
Kristian Høgsberg's avatar
Kristian Høgsberg committed
548
549
550
551
	intel/Makefile
	intel/libdrm_intel.pc
	radeon/Makefile
	radeon/libdrm_radeon.pc
Alex Deucher's avatar
Alex Deucher committed
552
553
	amdgpu/Makefile
	amdgpu/libdrm_amdgpu.pc
Kristian Høgsberg's avatar
Kristian Høgsberg committed
554
555
	nouveau/Makefile
	nouveau/libdrm_nouveau.pc
Rob Clark's avatar
Rob Clark committed
556
557
	omap/Makefile
	omap/libdrm_omap.pc
Inki Dae's avatar
Inki Dae committed
558
559
	exynos/Makefile
	exynos/libdrm_exynos.pc
Rob Clark's avatar
Rob Clark committed
560
561
	freedreno/Makefile
	freedreno/libdrm_freedreno.pc
562
563
	tegra/Makefile
	tegra/libdrm_tegra.pc
564
565
	vc4/Makefile
	vc4/libdrm_vc4.pc
566
567
	etnaviv/Makefile
	etnaviv/libdrm_etnaviv.pc
568
	tests/Makefile
569
570
	tests/modeprint/Makefile
	tests/modetest/Makefile
571
	tests/kms/Makefile
572
	tests/kmstest/Makefile
Paulo Zanoni's avatar
Paulo Zanoni committed
573
	tests/proptest/Makefile
574
	tests/radeon/Makefile
Alex Deucher's avatar
Alex Deucher committed
575
	tests/amdgpu/Makefile
Jesse Barnes's avatar
Jesse Barnes committed
576
	tests/vbltest/Makefile
577
	tests/exynos/Makefile
578
	tests/tegra/Makefile
579
	tests/nouveau/Makefile
580
	tests/etnaviv/Makefile
581
	tests/util/Makefile
582
	man/Makefile
583
	libdrm.pc])
584
AC_OUTPUT
585
586
587
588

echo ""
echo "$PACKAGE_STRING will be compiled with:"
echo ""
Jakob Bornecrantz's avatar
Jakob Bornecrantz committed
589
echo "  libkms         $LIBKMS"
590
echo "  Intel API      $INTEL"
591
echo "  vmwgfx API     $VMWGFX"
592
echo "  Radeon API     $RADEON"
Alex Deucher's avatar
Alex Deucher committed
593
echo "  AMDGPU API     $AMDGPU"
594
echo "  Nouveau API    $NOUVEAU"
Rob Clark's avatar
Rob Clark committed
595
echo "  OMAP API       $OMAP"
Inki Dae's avatar
Inki Dae committed
596
echo "  EXYNOS API     $EXYNOS"
597
echo "  Freedreno API  $FREEDRENO (kgsl: $FREEDRENO_KGSL)"
598
echo "  Tegra API      $TEGRA"
599
echo "  VC4 API        $VC4"
600
echo "  Etnaviv API    $ETNAVIV"
601
echo ""