172b676d7Smrg#  Copyright 2005 Adam Jackson.
272b676d7Smrg#
372b676d7Smrg#  Permission is hereby granted, free of charge, to any person obtaining a
472b676d7Smrg#  copy of this software and associated documentation files (the "Software"),
572b676d7Smrg#  to deal in the Software without restriction, including without limitation
672b676d7Smrg#  on the rights to use, copy, modify, merge, publish, distribute, sub
772b676d7Smrg#  license, and/or sell copies of the Software, and to permit persons to whom
872b676d7Smrg#  the Software is furnished to do so, subject to the following conditions:
972b676d7Smrg#
1072b676d7Smrg#  The above copyright notice and this permission notice (including the next
1172b676d7Smrg#  paragraph) shall be included in all copies or substantial portions of the
1272b676d7Smrg#  Software.
1372b676d7Smrg#
1472b676d7Smrg#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1572b676d7Smrg#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1672b676d7Smrg#  FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
1772b676d7Smrg#  ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1872b676d7Smrg#  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1972b676d7Smrg#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2072b676d7Smrg#
2172b676d7Smrg# Process this file with autoconf to produce a configure script
2272b676d7Smrg
2374c14cd6Smrg# Initialize Autoconf
2474c14cd6SmrgAC_PREREQ([2.60])
2572b676d7SmrgAC_INIT([xf86-video-sis],
2674fcc364Smrg        [0.12.0],
2774fcc364Smrg        [https://gitlab.freedesktop.org/xorg/driver/xf86-video-sis/issues],
2874c14cd6Smrg        [xf86-video-sis])
2972b676d7SmrgAC_CONFIG_SRCDIR([Makefile.am])
3074c14cd6SmrgAC_CONFIG_HEADERS([config.h])
3172b676d7SmrgAC_CONFIG_AUX_DIR(.)
3272b676d7Smrg
3374c14cd6Smrg# Initialize Automake
34e35772b2SmrgAM_INIT_AUTOMAKE([foreign dist-bzip2])
3572b676d7Smrg
3674c14cd6Smrg# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
37e35772b2Smrgm4_ifndef([XORG_MACROS_VERSION],
3874c14cd6Smrg          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
3974c14cd6SmrgXORG_MACROS_VERSION(1.8)
40e35772b2SmrgXORG_DEFAULT_OPTIONS
41e35772b2Smrg
4274c14cd6Smrg# Initialize libtool
4372b676d7SmrgAC_DISABLE_STATIC
4472b676d7SmrgAC_PROG_LIBTOOL
4572b676d7Smrg
4672b676d7SmrgAH_TOP([#include "xorg-server.h"])
4772b676d7Smrg
4874c14cd6Smrg# Define a configure option for an alternate module directory
4972b676d7SmrgAC_ARG_WITH(xorg-module-dir,
5074c14cd6Smrg            AS_HELP_STRING([--with-xorg-module-dir=DIR],
5172b676d7Smrg                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
5272b676d7Smrg            [moduledir="$withval"],
5372b676d7Smrg            [moduledir="$libdir/xorg/modules"])
5472b676d7Smrg
5574c14cd6SmrgAC_ARG_ENABLE(dri, AS_HELP_STRING([--disable-dri],
5672b676d7Smrg                                  [Disable DRI support [[default=auto]]]),
5772b676d7Smrg              [DRI="$enableval"],
5872b676d7Smrg              [DRI=auto])
5972b676d7Smrg
6074c14cd6Smrg# Store the list of server defined optional extensions in REQUIRED_MODULES
6172b676d7SmrgXORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto)
6272b676d7SmrgXORG_DRIVER_CHECK_EXT(RANDR, randrproto)
6372b676d7SmrgXORG_DRIVER_CHECK_EXT(RENDER, renderproto)
6472b676d7SmrgXORG_DRIVER_CHECK_EXT(XV, videoproto)
6572b676d7SmrgXORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
6672b676d7Smrg
6774c14cd6Smrg# Obtain compiler/linker options for the driver dependencies
6874c14cd6SmrgPKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto xf86dgaproto >= 2.1 $REQUIRED_MODULES])
69e47418d9SmrgPKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
70e47418d9Smrg                  HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
71e47418d9Smrg                  HAVE_XEXTPROTO_71="no")
72e47418d9SmrgAM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ])
73e35772b2Smrgsdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
7472b676d7Smrg
7572b676d7Smrg# Checks for libraries.
7672b676d7Smrg
7772b676d7Smrgif test "$DRI" != no; then
7874fcc364Smrg        if test "$cross_compiling" = "no" ; then
7974fcc364Smrg               AC_CHECK_FILE([${sdkdir}/dri.h],
8074fcc364Smrg                             [have_dri_h="yes"], [have_dri_h="no"])
8174fcc364Smrg               AC_CHECK_FILE([${sdkdir}/sarea.h],
8274fcc364Smrg                             [have_sarea_h="yes"], [have_sarea_h="no"])
8374fcc364Smrg               AC_CHECK_FILE([${sdkdir}/dristruct.h],
8474fcc364Smrg                             [have_dristruct_h="yes"], [have_dristruct_h="no"])
8574fcc364Smrg        else
8674fcc364Smrg		have_dri_h="yes"
8774fcc364Smrg		have_sarea_h="yes"
8874fcc364Smrg		have_dristruct_h="yes"
8974fcc364Smrg        fi
9072b676d7Smrgfi
9172b676d7Smrg
9272b676d7SmrgAC_MSG_CHECKING([whether to include DRI support])
9372b676d7Smrgif test x$DRI = xauto; then
9472b676d7Smrg        if test "$have_dri_h" = yes -a \
9572b676d7Smrg                "$have_sarea_h" = yes -a \
9672b676d7Smrg                "$have_dristruct_h" = yes; then
9772b676d7Smrg                DRI="yes"
9872b676d7Smrg        else
9972b676d7Smrg                DRI="no"
10072b676d7Smrg        fi
10172b676d7Smrgfi
10272b676d7SmrgAC_MSG_RESULT([$DRI])
10372b676d7Smrg
10472b676d7SmrgAM_CONDITIONAL(DRI, test x$DRI = xyes)
10572b676d7Smrgif test "$DRI" = yes; then
10672b676d7Smrg        PKG_CHECK_MODULES(DRI, [libdrm >= 2.0 xf86driproto])
10774c14cd6Smrg        AC_DEFINE(SISDRI,1,[Enable DRI driver support])
10874c14cd6Smrg        AC_DEFINE(SISDRI_DEVEL,1,[Enable developmental DRI driver support])
10974c14cd6Smrgfi
11074c14cd6Smrg
11174c14cd6SmrgAC_ARG_ENABLE(xaa,
11274c14cd6Smrg              AS_HELP_STRING([--enable-xaa],
11374c14cd6Smrg                             [Enable legacy X Acceleration Architecture (XAA) [default=auto]]),
11474c14cd6Smrg              [XAA="$enableval"],
11574c14cd6Smrg              [XAA=auto])
11674c14cd6Smrgif test "x$XAA" != xno; then
11774c14cd6Smrg        save_CFLAGS=$CFLAGS
11874c14cd6Smrg        save_CPPFLAGS=$CPPFLAGS
11974c14cd6Smrg        CFLAGS=$XORG_CFLAGS
12074c14cd6Smrg        CPPFLAGS="$XORG_CFLAGS"
12174c14cd6Smrg        AC_CHECK_HEADERS([xaa.h], XAA=yes, XAA=no)
12274c14cd6Smrg        CFLAGS=$save_CFLAGS
12374c14cd6Smrg        CPPFLAGS=$save_CPPFLAGS
12472b676d7Smrgfi
12574c14cd6SmrgAC_MSG_CHECKING([whether to include XAA support])
12674c14cd6SmrgAM_CONDITIONAL(XAA, test "x$XAA" = xyes)
12774c14cd6SmrgAC_MSG_RESULT([$XAA])
12872b676d7Smrg
12972b676d7Smrg# technically this should be a configure flag.  meh.
13074fcc364SmrgAC_DEFINE(USE_EXA, 1, [Build support for EXA])
13172b676d7Smrg
1321fd23544SmrgSAVE_CPPFLAGS="$CPPFLAGS"
1331fd23544SmrgCPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
1341fd23544SmrgAC_CHECK_DECL(XSERVER_LIBPCIACCESS,
1351fd23544Smrg              [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no],
1361fd23544Smrg              [#include "xorg-server.h"])
1371fd23544SmrgCPPFLAGS="$SAVE_CPPFLAGS"
1381fd23544Smrg
1391fd23544Smrgif test "x$XSERVER_LIBPCIACCESS" = xyes; then
14074c14cd6Smrg    PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.12.901])
1411fd23544Smrg    XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
1421fd23544Smrgfi
1431fd23544SmrgAM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
1441fd23544Smrg
14572b676d7SmrgAC_SUBST([moduledir])
14672b676d7Smrg
14772b676d7SmrgDRIVER_NAME=sis
14872b676d7SmrgAC_SUBST([DRIVER_NAME])
14972b676d7Smrg
15074c14cd6SmrgAC_CONFIG_FILES([
15174c14cd6Smrg                Makefile
15274c14cd6Smrg                src/Makefile
15374c14cd6Smrg                man/Makefile
15472b676d7Smrg])
15574c14cd6SmrgAC_OUTPUT
156