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],
23
        [2.4.94],
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
if test "x$UDEV" = xyes; then
	AC_DEFINE(UDEV, 1, [Have UDEV support])
350
351
else
	AC_DEFINE(UDEV, 0)
Dave Airlie's avatar
Dave Airlie committed
352
353
fi

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

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

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

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

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

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

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

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

399
400
401
402
403
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
404
405
406
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])
407
408
else
	AC_DEFINE(HAVE_FREEDRENO_KGSL, 0)
409
410
fi

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

418
419
420
421
422
423
424
425
426
427
428
429
430
431
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
432
	fi
433
434
else
	have_cunit=no
435
fi
436
AM_CONDITIONAL(HAVE_CUNIT, [test "x$have_cunit" != "xno"])
437

Alex Deucher's avatar
Alex Deucher committed
438
439
440
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
441
442
443
444

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

449
450
AM_CONDITIONAL(HAVE_TEGRA, [test "x$TEGRA" = xyes])

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

458
459
AM_CONDITIONAL(HAVE_ETNAVIV, [test "x$ETNAVIV" = xyes])

460
461
AM_CONDITIONAL(HAVE_INSTALL_TESTS, [test "x$INSTALL_TESTS" = xyes])

462
463
464
465
AC_ARG_ENABLE([cairo-tests],
              [AS_HELP_STRING([--enable-cairo-tests],
                              [Enable support for Cairo rendering in tests (default: auto)])],
              [CAIRO=$enableval], [CAIRO=auto])
466
467
468
if test "x$CAIRO" != xno; then
	PKG_CHECK_MODULES(CAIRO, cairo, [HAVE_CAIRO=yes], [HAVE_CAIRO=no])
fi
469
470
471
AC_MSG_CHECKING([whether to enable Cairo tests])
if test "x$CAIRO" = xauto; then
	CAIRO="$HAVE_CAIRO"
472
fi
473
474
475
476
477
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
478
479
else
	AC_DEFINE(HAVE_CAIRO, 0)
480
481
482
fi
AC_MSG_RESULT([$CAIRO])
AM_CONDITIONAL(HAVE_CAIRO, [test "x$CAIRO" = xyes])
483

484
485
# xsltproc for docbook manpages
AC_ARG_ENABLE([manpages],
Emil Velikov's avatar
Emil Velikov committed
486
              AS_HELP_STRING([--enable-manpages], [enable manpages @<:@default=auto@:>@]),
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
              [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"])
503

504
505
506
AC_ARG_ENABLE(valgrind,
              [AS_HELP_STRING([--enable-valgrind],
                             [Build libdrm with  valgrind support (default: auto)])],
507
                             [VALGRIND=$enableval], [VALGRIND=auto])
508
509
510
if test "x$VALGRIND" != xno; then
	PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no])
fi
511
512
513
514
515
516
517
518
519
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
520
	AC_DEFINE([HAVE_VALGRIND], 1, [Use valgrind intrinsics to suppress false warnings])
Eric Engestrom's avatar
Eric Engestrom committed
521
522
else
	AC_DEFINE([HAVE_VALGRIND], 0)
523
fi
524

525
526
AC_MSG_RESULT([$VALGRIND])

527
528
529
530
531
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)
532

Emil Velikov's avatar
Emil Velikov committed
533
AC_MSG_CHECKING([whether $CC supports __attribute__(("hidden"))])
534
535
536
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]));
537

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

544
545
CFLAGS="$CFLAGS -include config.h"

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

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