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