summaryrefslogtreecommitdiff
path: root/configure.ac
blob: f30691da604829779f3e86727020e9b9b0537762 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# Process this file with autoconf to produce a configure script

AC_PREREQ(2.57)
AC_INIT([xf86-video-unichrome],
        0.2.0.0,
        [https://unichrome.sf.net/],
        xf86-video-unichrome)

AC_CONFIG_SRCDIR([Makefile.am])
AM_CONFIG_HEADER([config.h])
AC_CONFIG_AUX_DIR(.)

AM_INIT_AUTOMAKE([dist-bzip2])

AM_MAINTAINER_MODE

# Checks for programs.
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_PROG_CC

# -std=gnu99 is needed because otherwise os.h and commas at the end of enums
# stink up the log. How hard would it have been to avoid those in those
# headers?
# The AC_PROG_CC_C99 macro only came into existence at autoconf 2.60,
# so bluntly force it this way.
if test "x$GCC" = "xyes"; then
        CFLAGS="$CFLAGS -Wall -pedantic -std=gnu99"
fi

AH_TOP([#include "xorg-server.h"])

AC_ARG_WITH(xorg-module-dir,
            AC_HELP_STRING([--with-xorg-module-dir=DIR],
                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
            [moduledir="$withval"],
            [moduledir="$libdir/xorg/modules"])

AC_MSG_CHECKING([whether to build wrapper driver])
AC_ARG_WITH(wrapper,
	    AC_HELP_STRING([--with-wrapper],
			   [Enable building of the wrapper driver [[default=yes]]]),
	    ,
	    [with_wrapper=yes])
AC_MSG_RESULT([$with_wrapper])

AM_CONDITIONAL(BUILD_WRAPPER, test x$with_wrapper = xyes)
if test x$with_wrapper = xyes; then
   AC_OUTPUT([wrapper/Makefile])
fi

AC_ARG_ENABLE(dri, AC_HELP_STRING([--disable-dri],
              [Disable DRI support [[default=auto]]]),
              [DRI="$enableval"],
              [DRI=auto])

AC_ARG_ENABLE(have_xvmc, AC_HELP_STRING([--enable-xvmc],
	      [Build XvMC support [[default=auto]]]),
	      [have_xvmc="$enableval"],
	      [have_xvmc=auto])

# Checks for extensions
XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
XORG_DRIVER_CHECK_EXT(XF86DRI, xextproto x11)
XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
XORG_DRIVER_CHECK_EXT(XSERVER_LIBPCIACCESS, pciaccess)

# Checks for pkg-config packages
PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto $REQUIRED_MODULES])

AC_MSG_CHECKING([X SDK headers directory])
sdkdir=$(pkg-config --variable=sdkdir xorg-server)
AC_MSG_RESULT([$sdkdir])

# Checks for libraries.

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([inttypes.h])

if test "$DRI" != no; then
        AC_CHECK_FILE([${sdkdir}/dri.h],
                      [have_dri_h="yes"], [have_dri_h="no"])
        AC_CHECK_FILE([${sdkdir}/sarea.h],
                      [have_sarea_h="yes"], [have_sarea_h="no"])
        AC_CHECK_FILE([${sdkdir}/dristruct.h],
                      [have_dristruct_h="yes"], [have_dristruct_h="no"])
	AC_CHECK_HEADERS([GL/gl.h],
		      [have_gl_h="yes"], [have_gl_h="no"])
fi

if test x$DRI = xauto; then
        if test "$have_dri_h" = yes -a \
                "$have_sarea_h" = yes -a \
                "$have_dristruct_h" = yes -a \
		"$have_gl_h" = yes; then
                DRI="yes"
        else
                DRI="no"
        fi
fi
AC_MSG_CHECKING([whether to include DRI support])
AC_MSG_RESULT([$DRI])

AM_CONDITIONAL(DRI, test x$DRI = xyes)
if test "$DRI" = yes; then
        PKG_CHECK_MODULES(DRI, [libdrm xf86driproto])
	AC_DEFINE(DRIVER_DRI,1,[Enable DRI driver support])
fi

AH_VERBATIM([HAVE_DRI],[/* xorg-server.h might not have the same idea. */
#if defined(XF86DRI) && defined(DRIVER_DRI)
#define HAVE_DRI 1
#endif])

# check whether to build Xv.
AC_CHECK_FILE([${sdkdir}/xf86xv.h],
	      [have_xf86xv_h="yes"], [have_xf86xv_h="no"])
AC_CHECK_FILE([${sdkdir}/xf86xvpriv.h],
	      [have_xf86xvpriv_h="yes"], [have_xf86xvpriv_h="no"])
AC_MSG_CHECKING([whether to include XV support])
if test "$have_xf86xv_h" = yes -a \
	"$have_xf86xvpriv_h" = yes; then
	have_xv="yes"
else
	have_xv="no"
fi
AC_MSG_RESULT([$have_xv])
AM_CONDITIONAL(XV, test x$have_xv = xyes)

# check whether reputimage gained some extra arguments
if test "x$have_xv" = xyes; then
	SAVED_CFLAGS="$CFLAGS"
	CFLAGS="$CFLAGS $XORG_CFLAGS"

	AC_CHECK_MEMBER([ScrnInfoRec.ModeSet],
		[SCRNINFO_HAS_MODESET=yes], [SCRNINFO_HAS_MODESET=no],
		[#include "${sdkdir}/xf86str.h"])
	if test "x$SCRNINFO_HAS_MODESET" = xyes; then
		AC_DEFINE(XV_NEW_REPUT, 1,
			[XvReputImage takes more all coordinates])
	fi

	CFLAGS="$SAVED_CFLAGS"
fi
AM_CONDITIONAL(XV_NEW_REPUT, test x$XV_NEW_REPUT = xyes)

# Check what parts of XvMC are around.
AC_MSG_CHECKING([XvMC protocol headers directory])
xvmcprotodir=$(pkg-config --variable=includedir xvmc)
AC_MSG_RESULT([$xvmcprotodir])

if test "x$have_xvmc" != xno; then
	AC_CHECK_FILE([${xvmcprotodir}/X11/extensions/XvMC.h],
		      [have_xvmc_h="yes"], [have_xvmc_h="no"])
	AC_CHECK_FILE([${xvmcprotodir}/X11/extensions/vldXvMC.h],
		      [have_vldxvmc_h="yes"], [have_vldxvmc_h="no"])
	AC_CHECK_FILE([${xvmcprotodir}/X11/extensions/XvMClib.h],
		      [have_xvmclib_h="yes"], [have_xvmclib_h="no"])
fi

# check for driver side xvmc support.
AC_MSG_CHECKING([whether to include driver-side XvMC support])
if test "x$have_xv" = xyes -a \
	"x$DRI" = xyes -a \
	"x$have_xvmc" != xno -a \
	"x$have_xvmc_h" = xyes -a \
	"x$have_vldxvmc_h" = xyes; then
	build_xvmc="yes"
else
	build_xvmc="no"
fi
AC_MSG_RESULT([$build_xvmc])
AM_CONDITIONAL(BUILD_XVMC, test "x$build_xvmc" = xyes)
if test "x$build_xvmc" = xyes; then
	AC_DEFINE(BUILD_XVMC, 1, [Build driver side XvMC support])
fi

# check whether we need to build the xvmc library.
AC_MSG_CHECKING([whether to include client-side XvMC support])
if test "x$build_xvmc" = xyes -a \
	"x$have_xvmclib_h" = xyes; then
	build_xvmclib="yes"
else
	build_xvmclib="no"
fi
AC_MSG_RESULT([$build_xvmclib])
AM_CONDITIONAL(BUILD_XVMCLIB, test "x$build_xvmclib" = xyes)
if test "x$build_xvmclib" = xyes; then
	AC_OUTPUT([
		lib/Makefile
		lib/xvmc/Makefile
		])
fi

if test "x$build_xvmclib" = xyes; then
	AC_EGREP_HEADER([dixLookupResourceByType], [${sdkdir}/resource.h],
			[new_lookupresource="yes"], [new_lookupresource="no"])
	AC_MSG_CHECKING([whether LookupIDByType() was replaced by dixLookupResourceByType()])
	AC_MSG_RESULT([$new_lookupresource])
	if test "x$new_lookupresource" = xyes; then
		AC_DEFINE(NEW_LOOKUPRESOURCE, 1,
			  [LookupIDByType() was replaced by dixLookupResourceByType()])
	fi
fi

# vldXvMC.h is broken. It includes XvMClib.h and this leads to a big mess
# in some (possibly broken) installations.
if test "x$build_xvmc" = xyes; then
	# if we have xvmclib.h, then we test this way.
	if test "x$have_xvmclib_h" = xyes; then
		AC_EGREP_HEADER([XvMCQueryExtension], [${xvmcprotodir}/X11/extensions/vldXvMC.h],
				[broken_vldxvmc_h="yes"], [broken_vldxvmc_h="no"])
	else
		AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include "vldXvMC.h"]])],
				  [broken_vldxvmc_h="no"], [broken_vldxvmc_h="yes"])
	fi

	AC_MSG_CHECKING([whether vldXvMC.h wrongly includes XvMClib.h])
	AC_MSG_RESULT([$broken_vldxvmc_h])
	if test "x$broken_vldxvmc_h" = xyes; then
		AC_DEFINE(BROKEN_VLDXVMC_H, 1, [vldXvMC.h wrongly includes XvMClib.h])
	fi
fi

# Somewhere along the way the non ANSI C compat code got removed.
AC_CHECK_FILE([${sdkdir}/xf86_ansic.h],
              [AC_DEFINE([HAVE_XF86_ANSIC_H], [1],
		         [xf86 non-ansi C compat code still there?])])

SAVED_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $XORG_CFLAGS"

# Check wether MonRec has a reducedblanking member.
AC_CHECK_MEMBER([MonRec.reducedblanking],
         [MONREC_HAS_REDUCED=yes], [MONREC_HAS_REDUCED=no],
         [#include "${sdkdir}/xf86.h"])
if test "x$MONREC_HAS_REDUCED" = xyes; then
        AC_DEFINE(MONREC_HAS_REDUCED, 1, [MonRec has member reducedblanking])
fi

CFLAGS="$SAVED_CFLAGS"

# in the xserver 1.7 timeframe, the protocol headers were split up.
AC_MSG_CHECKING([Xext protocol headers directory])
xextprotodir=$(pkg-config --variable=includedir xextproto)
AC_MSG_RESULT([$xextprotodir])

AC_CHECK_FILE([${xextprotodir}/X11/extensions/dpmsconst.h],
	      [have_dpmsconst_h="yes"], [have_dpmsconst_h="no"])
if test "x$have_dpmsconst_h" = xyes; then
	AC_DEFINE(HAVE_DPMSCONST_H, 1, [Proto Headers have dpmsconst.h])
fi

# in the xserver 1.7 timeframe, loader symbol listing vanished.
AC_CHECK_DECL([LoaderRefSymLists],
	      [removed_loader_lists="no"], [removed_loader_lists="yes"],
	      [#include "${sdkdir}/xf86Module.h"])
if test "x$removed_loader_lists" = xyes; then
	AC_DEFINE(REMOVED_LOADER_LISTS, 1, [Build without loader symbol lists.])
fi

# in the xserver 1.7 timeframe, many years after libpciaccess deliberately
# overlooked it, RAC got reinvented.
AC_CHECK_FILE([${sdkdir}/xf86RAC.h],
	      [reinvented_rac="no"], [reinvented_rac="yes"])
AC_MSG_CHECKING([whether RAC got reinvented])
AC_MSG_RESULT([$reinvented_rac])
if test "x$reinvented_rac" = xyes; then
	AC_DEFINE(REINVENTED_RAC, 1, [The RAC infrastructure got reinvented.])
fi

AC_SUBST([DRI_CFLAGS])
AC_SUBST([XORG_CFLAGS])
AC_SUBST([moduledir])

XORG_MANPAGE_SECTIONS
XORG_RELEASE_VERSION

AC_OUTPUT([
	Makefile
	src/Makefile
	man/Makefile
])