configure.ac revision 79d5fcd7
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-geode],
26        [2.11.21],
27        [https://gitlab.freedesktop.org/xorg/driver/xf86-video-geode/-/issues],
28        [xf86-video-geode],
29        [http://www.x.org/wiki/GeodeDriver])
30
31AC_CONFIG_SRCDIR([Makefile.am])
32AC_CONFIG_HEADERS([config.h])
33AC_CONFIG_MACRO_DIR([m4])
34AC_CONFIG_AUX_DIR([build-aux])
35
36# Initialize Automake
37AM_INIT_AUTOMAKE([foreign dist-xz])
38AM_MAINTAINER_MODE
39
40# Initialize libtool
41AC_DISABLE_STATIC
42AC_PROG_LIBTOOL
43
44# Require xorg-macros: XORG_DEFAULT_OPTIONS
45m4_ifndef([XORG_MACROS_VERSION], 
46          [m4_fatal([must install xorg-macros 1.4 or later before running autoconf/autogen])])
47XORG_MACROS_VERSION(1.4)
48XORG_DEFAULT_OPTIONS
49
50# Checks for programs.
51AC_DISABLE_STATIC
52AC_PROG_LIBTOOL
53
54AH_TOP([#include "xorg-server.h"])
55
56# -----------------------------------------------------------------------------
57#			Configuration options
58# -----------------------------------------------------------------------------
59# Define a configure option for an alternate input module directory
60AC_ARG_WITH(xorg-module-dir,
61            AS_HELP_STRING([--with-xorg-module-dir=DIR],
62                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
63            [moduledir="$withval"],
64            [moduledir="$libdir/xorg/modules"])
65AC_SUBST([moduledir])
66
67# Define a configure option to enable/disable lcd panel support
68AC_ARG_ENABLE(geodegx-panel, 
69	      AS_HELP_STRING([--disable-geodegx-panel],
70	      	             [Disable support for flatpanels with the Geode GX]),
71	      [ ], 
72	      [ PANEL_CPPFLAGS=-DPNL_SUP ])
73AC_SUBST(PANEL_CPPFLAGS)
74
75# Define a configure option to enable/disable ztv
76AC_ARG_ENABLE(ztv,
77	AS_HELP_STRING([--enable-ztv],
78	    [Enable Video For Linux based ZTV driver (default: auto-detected)]),
79	    [ztv=$enableval],
80	    [ztv=auto])
81
82# Check for Video4Linux Version 2 (V4L2) availability
83AC_CHECK_HEADERS([linux/videodev2.h],[v4l2=yes],[v4l2=no])
84if test "x$ztv" != "xno" ; then
85    if test "x$v4l2" = "xno" ; then
86	if test "x$ztv" = "xyes" ; then
87	    # User really wants ztv but V4L2 is not found
88	    AC_MSG_ERROR([ZTV driver requested, but videodev2.h not found.])
89	fi
90    else
91	BUILD_ZTV=yes
92    fi
93fi
94AM_CONDITIONAL(BUILD_ZTV, [test "x$BUILD_ZTV" = xyes])
95
96# Check if GCC supports compiling in 32 bit mode for 64 bit computers
97case $host_cpu in
98    x86_64*|amd64*)
99	if  test "x$GCC" = xyes ; then
100	    SAVE_CFLAGS="$CFLAGS"
101	    CFLAGS="$CFLAGS -m32"
102	    AC_MSG_CHECKING([if $CC supports the -m32 Intel/AMD option])
103	    AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
104#include <unistd.h>
105int
106main ()
107{
108  ;
109  return 0;
110}]])],
111		[m32_support=yes; M32_CFLAGS=-m32],
112		[m32_support=no])
113	    AC_MSG_RESULT([$m32_support])
114	    CFLAGS="$SAVE_CFLAGS"
115	fi
116	;;
117esac
118AC_SUBST([M32_CFLAGS])
119
120# Store the list of server defined optional extensions in REQUIRED_MODULES
121XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
122XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
123XORG_DRIVER_CHECK_EXT(XV, videoproto)
124XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
125
126# Obtain compiler/linker options for the Geode driver dependencies
127PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto $REQUIRED_MODULES])
128PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
129                  HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
130                  HAVE_XEXTPROTO_71="no")
131
132# Define a configure option to enable/disable XAA support;
133# handles unavailability of XAA since xserver-1.13
134AC_ARG_ENABLE(xaa,
135    AS_HELP_STRING([--enable-xaa],
136                   [Enable legacy X Acceleration Architecture (XAA) [default=auto]]))
137
138AS_IF([test "x$enable_xaa" != "xno"],
139    [
140        save_CFLAGS=$CFLAGS
141        save_CPPFLAGS=$CPPFLAGS
142        CFLAGS=$XORG_CFLAGS
143        CPPFLAGS="$XORG_CFLAGS"
144        AC_CHECK_HEADERS([xaa.h], have_XAA=yes, have_XAA=no)
145        CFLAGS=$save_CFLAGS
146        CPPFLAGS=$save_CPPFLAGS
147])
148
149AC_MSG_CHECKING([whether to include XAA support])
150
151AS_IF([test "x$have_XAA" = "xyes"],
152    [AC_MSG_RESULT([yes])],
153    [AS_IF([test "x$enable_xaa" = "xyes"],
154        [AC_MSG_ERROR([XAA requested but not found (perhaps building against xserver-1.13 or newer?)])],
155        [AC_MSG_RESULT([no])
156    ])
157])
158
159# Checks for libpciaccess support.
160SAVE_CPPFLAGS="$CPPFLAGS"
161CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
162AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
163              [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no],
164              [#include "xorg-server.h"])
165CPPFLAGS="$SAVE_CPPFLAGS"
166
167if test "x$XSERVER_LIBPCIACCESS" = xyes; then
168    PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
169    XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
170fi
171
172AC_CONFIG_FILES([
173	Makefile
174	src/Makefile
175])
176AC_OUTPUT
177