configure.ac revision 71ba42d0
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
23AC_PREREQ(2.57)
24AC_INIT([xf86-video-nv],
25        2.1.17,
26        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
27        xf86-video-nv)
28
29AC_CONFIG_SRCDIR([Makefile.am])
30AM_CONFIG_HEADER([config.h])
31
32# Require xorg-macros: XORG_DEFAULT_OPTIONS
33m4_ifndef([XORG_MACROS_VERSION], 
34          [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
35XORG_MACROS_VERSION(1.3)
36XORG_DEFAULT_OPTIONS
37
38AC_CONFIG_AUX_DIR(.)
39
40AM_INIT_AUTOMAKE([foreign dist-bzip2])
41
42AM_MAINTAINER_MODE
43
44# Checks for programs.
45AC_DISABLE_STATIC
46AC_PROG_LIBTOOL
47AC_PROG_CC
48
49AH_TOP([#include "xorg-server.h"])
50
51# Options
52AC_ARG_WITH(xorg-module-dir,
53            AC_HELP_STRING([--with-xorg-module-dir=DIR],
54                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
55            [moduledir="$withval"],
56            [moduledir="$libdir/xorg/modules"])
57
58AC_ARG_WITH(xserver-source,AC_HELP_STRING([--with-xserver-source=XSERVER_SOURCE],
59                                          [Path to X server source tree]),
60                           [ XSERVER_SOURCE="$withval" ],
61                           [ XSERVER_SOURCE="" ])
62
63# Checks for extensions
64XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
65XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
66XORG_DRIVER_CHECK_EXT(XV, videoproto)
67XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
68
69# Checks for pkg-config packages
70PKG_CHECK_MODULES(XORG, [xorg-server >= 1.2 xproto fontsproto $REQUIRED_MODULES])
71PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
72                  HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
73                  HAVE_XEXTPROTO_71="no")
74AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ])
75
76# Checks for libraries.
77
78# Checks for header files.
79AC_HEADER_STDC
80
81save_CFLAGS="$CFLAGS"
82CFLAGS="$XORG_CFLAGS"
83
84# RandR 1.2
85AC_CHECK_HEADER(xf86Modes.h,[BUILD_XMODES=no],[BUILD_XMODES=yes],[#include "xorg-server.h"])
86
87# PCI rework
88AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
89              [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no],
90              [#include "xorg-server.h"])
91if test "x$XSERVER_LIBPCIACCESS" = "xyes"; then
92    PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.8.0])
93fi
94
95CFLAGS="$save_CFLAGS"
96
97AM_CONDITIONAL(BUILD_XMODES, test "x$BUILD_XMODES" = xyes)
98if test "x$XSERVER_SOURCE" != x; then
99    if test -d "$XSERVER_SOURCE"; then
100        XSERVER_SOURCE=`cd "$XSERVER_SOURCE" && pwd`
101        if test -f "$XSERVER_SOURCE/hw/xfree86/modes/xf86Modes.h" -a -f "$XSERVER_SOURCE/hw/xfree86/parser/xf86Parser.h"; then
102            :
103        else
104            AC_ERROR([Server source at $XSERVER_SOURCE doesn't have the new mode code])
105        fi
106    else
107        AC_ERROR([Can't find xserver-source path $XSERVER_SOURCE])
108    fi
109fi
110if test "x$BUILD_XMODES" = xno; then
111    AC_MSG_NOTICE([X server has new mode code])
112    XMODES_CFLAGS=
113    parser_dir=
114    modes_dir=
115else
116    if test "x$XSERVER_SOURCE" = x; then
117            AC_MSG_NOTICE([X server is missing new mode code and --with-xserver-source not specified, using local copy])
118            AC_MSG_NOTICE([If you're building from git, please read compat/README])
119            parser_dir='$(top_srcdir)/compat/parser'
120            modes_dir='$(top_srcdir)/compat/modes'
121    else
122            AC_MSG_NOTICE([Using mode code from $XSERVER_SOURCE])
123            parser_dir="$XSERVER_SOURCE/hw/xfree86/parser"
124            modes_dir="$XSERVER_SOURCE/hw/xfree86/modes"
125    fi
126    XMODES_CFLAGS="-DXF86_MODES_RENAME -I\"$modes_dir\" -I\"$parser_dir\""
127    AC_DEFINE(BUILD_XMODES, 1,[X server doesn't have built-in mode code, so we need to build it])
128fi
129AC_SUBST([XMODES_CFLAGS])
130AC_SUBST([parser_dir])
131AC_SUBST([modes_dir])
132
133# Substitutions
134AC_SUBST([XORG_CFLAGS])
135AC_SUBST([moduledir])
136
137DRIVER_NAME=nv
138AC_SUBST([DRIVER_NAME])
139
140AC_OUTPUT([
141	Makefile
142	src/Makefile
143	man/Makefile
144	compat/Makefile
145])
146