configure.ac revision 18781e08
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# Initialize Autoconf
24AC_PREREQ([2.60])
25AC_INIT([xf86-video-ati],
26        [7.8.0],
27        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
28        [xf86-video-ati])
29
30AC_CONFIG_SRCDIR([Makefile.am])
31AC_CONFIG_HEADERS([config.h])
32
33AC_CONFIG_AUX_DIR(.)
34
35# Initialize Automake
36AM_INIT_AUTOMAKE([foreign dist-bzip2])
37AC_SYS_LARGEFILE
38
39# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
40m4_ifndef([XORG_MACROS_VERSION],
41          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
42XORG_MACROS_VERSION(1.8)
43XORG_DEFAULT_OPTIONS
44
45# Initialize libtool
46AC_DISABLE_STATIC
47AC_PROG_LIBTOOL
48
49# Checks for programs.
50AM_PROG_CC_C_O
51
52if test "x$GCC" = "xyes"; then
53	CPPFLAGS="$CPPFLAGS -Wall"
54fi
55
56AH_TOP([#include "xorg-server.h"])
57
58# Define a configure option for an alternate module directory
59AC_ARG_WITH(xorg-module-dir,
60            AS_HELP_STRING([--with-xorg-module-dir=DIR],
61                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
62            [moduledir="$withval"],
63            [moduledir="$libdir/xorg/modules"])
64
65# Store the list of server defined optional extensions in REQUIRED_MODULES
66XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
67XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
68XORG_DRIVER_CHECK_EXT(XV, videoproto)
69XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
70
71# Checks for libraries.
72PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.58])
73PKG_CHECK_MODULES(LIBDRM_RADEON, [libdrm_radeon])
74
75# Obtain compiler/linker options for the driver dependencies
76PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10 xproto fontsproto xf86driproto $REQUIRED_MODULES])
77PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
78                  HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
79                  HAVE_XEXTPROTO_71="no")
80AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ])
81
82AC_ARG_ENABLE([udev],
83		AS_HELP_STRING([--disable-udev], [Disable libudev support [default=auto]]),
84		[enable_udev="$enableval"],
85		[enable_udev=auto])
86if test "x$enable_udev" != "xno"; then
87	PKG_CHECK_MODULES(LIBUDEV, [libudev], [LIBUDEV=yes], [LIBUDEV=no])
88	if test "x$LIBUDEV" = xyes; then
89		AC_DEFINE(HAVE_LIBUDEV, 1,[libudev support])
90	elif test "x$enable_udev" != "xauto"; then
91		AC_MSG_ERROR([Building with udev requested but libudev not found])
92	fi
93fi
94AM_CONDITIONAL(LIBUDEV, test x$LIBUDEV = xyes)
95
96SAVE_CPPFLAGS="$CPPFLAGS"
97CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
98
99AC_MSG_CHECKING([whether to include GLAMOR support])
100AC_ARG_ENABLE(glamor,
101	      AS_HELP_STRING([--disable-glamor],
102			     [Disable glamor, a new GL-based acceleration [default=enabled]]),
103	      [GLAMOR="$enableval"],
104	      [GLAMOR=yes])
105
106if test "x$GLAMOR" != "xno"; then
107	AC_CHECK_HEADERS([glamor.h], [GLAMOR_H="yes"], [GLAMOR_H="no"], [#include "xorg-server.h"])
108
109	if test "x$GLAMOR_H" = xyes; then
110		AC_CHECK_DECL(GLAMOR_NO_DRI3,
111			      [GLAMOR_XSERVER="yes"], [GLAMOR_XSERVER="no"],
112			      [#include "xorg-server.h"
113			       #include "glamor.h"])
114
115		AC_CHECK_DECL(glamor_glyphs_init,
116			      [AC_DEFINE(HAVE_GLAMOR_GLYPHS_INIT, 1,
117					 [Have glamor_glyphs_init API])], [],
118			      [#include "xorg-server.h"
119			       #include "glamor.h"])
120
121		AC_CHECK_DECL(glamor_egl_destroy_textured_pixmap,
122			      [AC_DEFINE(HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP, 1,
123					 [Have glamor_egl_destroy_textured_pixmap API])], [],
124			      [#include "xorg-server.h"
125			       #include "glamor.h"])
126	fi
127
128	if test "x$GLAMOR_XSERVER" != xyes; then
129		PKG_CHECK_MODULES(LIBGLAMOR, [glamor >= 0.6.0])
130		PKG_CHECK_MODULES(LIBGLAMOR_EGL, [glamor-egl])
131	fi
132	AC_DEFINE(USE_GLAMOR, 1, [Enable glamor acceleration])
133else
134	AC_MSG_RESULT([$GLAMOR])
135fi
136AM_CONDITIONAL(GLAMOR, test x$GLAMOR != xno)
137
138AC_CHECK_DECL(RegionDuplicate,
139	      [AC_DEFINE(HAVE_REGIONDUPLICATE, 1,
140	      [Have RegionDuplicate API])], [],
141	      [#include <xorg-server.h>
142	       #include <regionstr.h>])
143
144AC_CHECK_DECL(fbGlyphs,
145	      [AC_DEFINE(HAVE_FBGLYPHS, 1, [Have fbGlyphs API])], [],
146	      [#include <X11/Xmd.h>
147	       #include <X11/Xfuncproto.h>
148	       #include <X11/extensions/renderproto.h>
149	       #include <xorg-server.h>
150	       #include <picture.h>
151	       #include <glyphstr.h>
152	       #include <fbpict.h>])
153
154AC_CHECK_DECL(xf86CursorResetCursor,
155	      [AC_DEFINE(HAVE_XF86_CURSOR_RESET_CURSOR, 1,
156	      [Have xf86CursorResetCursor API])], [],
157	      [#include <xorg-server.h>
158	       #include <xf86Cursor.h>])
159
160AC_CHECK_DECL(xorg_list_init,
161	      [AC_DEFINE(HAVE_XORG_LIST, 1, [Have xorg_list API])], [],
162	      [#include <X11/Xdefs.h>
163	      #include "xorg-server.h"
164	      #include "list.h"])
165
166AC_CHECK_HEADERS([misyncshm.h], [], [],
167                 [#include <X11/Xdefs.h>
168	          #include <X11/Xfuncproto.h>
169	          #include <xorg-server.h>
170		  #include <screenint.h>])
171
172AC_CHECK_HEADERS([present.h], [], [],
173		 [#include <X11/Xmd.h>
174		 #include <X11/Xproto.h>
175		 #include <X11/X.h>
176		 #include "xorg-server.h"])
177
178AC_CHECK_HEADERS([dri3.h], [], [],
179		 [#include <X11/Xmd.h>
180		 #include <xorg-server.h>])
181
182CPPFLAGS="$SAVE_CPPFLAGS"
183
184PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
185XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
186
187# Checks for headers/macros for byte swapping
188# Known variants:
189#	<byteswap.h> bswap_16, bswap_32, bswap_64  (glibc)
190#	<sys/endian.h> __swap16, __swap32, __swap64 (OpenBSD)
191#	<sys/endian.h> bswap16, bswap32, bswap64 (other BSD's)
192#	and a fallback to local macros if none of the above are found
193
194# if <byteswap.h> is found, assume it's the correct version
195AC_CHECK_HEADERS([byteswap.h])
196
197# if <sys/endian.h> is found, have to check which version
198AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="no"])
199
200if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then
201	AC_MSG_CHECKING([for __swap16 variant of <sys/endian.h> byteswapping macros])
202	AC_LINK_IFELSE([AC_LANG_PROGRAM([
203#include <sys/types.h>
204#include <sys/endian.h>
205 ], [
206int a = 1, b;
207b = __swap16(a);
208 ])
209], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no'])
210	AC_MSG_RESULT([$SYS_ENDIAN__SWAP])
211
212	AC_MSG_CHECKING([for bswap16 variant of <sys/endian.h> byteswapping macros])
213	AC_LINK_IFELSE([AC_LANG_PROGRAM([
214#include <sys/types.h>
215#include <sys/endian.h>
216 ], [
217int a = 1, b;
218b = bswap16(a);
219 ])
220], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no'])
221	AC_MSG_RESULT([$SYS_ENDIAN_BSWAP])
222
223    	if test "$SYS_ENDIAN_BSWAP" = "yes" ; then
224		USE_SYS_ENDIAN_H=yes
225		BSWAP=bswap
226	else	
227	    	if test "$SYS_ENDIAN__SWAP" = "yes" ; then
228			USE_SYS_ENDIAN_H=yes
229			BSWAP=__swap
230		else
231			USE_SYS_ENDIAN_H=no
232		fi
233	fi
234
235	if test "$USE_SYS_ENDIAN_H" = "yes" ; then
236	    AC_DEFINE([USE_SYS_ENDIAN_H], 1, 
237		[Define to use byteswap macros from <sys/endian.h>])
238	    AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, 
239			[Define to 16-bit byteswap macro])
240	    AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, 
241			[Define to 32-bit byteswap macro])
242	    AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, 
243			[Define to 64-bit byteswap macro])
244	fi
245fi
246
247AC_SUBST([moduledir])
248
249DRIVER_NAME=ati
250AC_SUBST([DRIVER_NAME])
251
252AC_MSG_NOTICE(
253[The atimisc sub-driver has been split out to xf86-video-mach64:]
254[    git://anongit.freedesktop.org/git/xorg/driver/xf86-video-mach64]
255[Please install that driver as well for mach64-based cards.]
256)
257
258AC_MSG_NOTICE(
259[The r128 sub-driver has been split out to xf86-video-r128:]
260[    git://anongit.freedesktop.org/git/xorg/driver/xf86-video-r128]
261[Please install that driver as well for rage128-based cards.]
262)
263
264AC_CONFIG_FILES([
265                Makefile
266                src/Makefile
267                man/Makefile
268])
269AC_OUTPUT
270
271dnl
272dnl Output some configuration info for the user
273dnl
274echo ""
275echo "        prefix:              $prefix"
276echo "        exec_prefix:         $exec_prefix"
277echo "        libdir:              $libdir"
278echo "        includedir:          $includedir"
279
280echo ""
281echo "        CFLAGS:              $CFLAGS"
282echo "        CXXFLAGS:            $CXXFLAGS"
283echo "        Macros:              $DEFINES"
284
285echo ""
286echo "        Run '${MAKE-make}' to build xf86-video-ati"
287echo ""
288