summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 403c1205f29342e3d43617ef938ef20dcbfe38b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
dnl (C) Copyright IBM Corporation 2006
dnl All Rights Reserved.
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
dnl to deal in the Software without restriction, including without limitation
dnl on the rights to use, copy, modify, merge, publish, distribute, sub
dnl license, and/or sell copies of the Software, and to permit persons to whom
dnl the Software is furnished to do so, subject to the following conditions:
dnl
dnl The above copyright notice and this permission notice (including the next
dnl paragraph) shall be included in all copies or substantial portions of the
dnl Software.
dnl
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dnl FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
dnl IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
dnl DEALINGS IN THE SOFTWARE.
dnl
dnl Process this file with autoconf to create configure.

AC_PREREQ([2.57])

AC_INIT(libpciaccess, 0.10.7, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=libpciaccess], libpciaccess)
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE

# Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG
m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.2)
AM_CONFIG_HEADER(config.h)

# Check for progs
AC_PROG_CC
AC_PROG_LIBTOOL
XORG_CWARNFLAGS

pciids_path=/usr/share/hwdata
AC_ARG_WITH(pciids-path, AC_HELP_STRING([--with-pciids-path=PCIIDS_PATH],
	[Path to pci.ids file]), [pciids_path="$withval"])
AC_DEFINE_DIR(PCIIDS_PATH, pciids_path, [Path to pci.ids])

AC_ARG_ENABLE(linux-rom-fallback, AS_HELP_STRING([--enable-linux-rom-fallback],
		[Enable support for falling back to /dev/mem for roms (default: disabled)]),
		[LINUX_ROM=$enableval],[LINUX_ROM=no])

if test "x$LINUX_ROM" = xyes; then
	AC_DEFINE(LINUX_ROM, 1, [Linux ROM read fallback])
fi

use_zlib=no
AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib],
	[Enable zlib support to read gzip compressed pci.ids]),
	[use_zlib="$withval"])
if test "x$use_zlib" = xyes; then
	AC_CHECK_LIB(z, gzopen,
	[PCIACCESS_LIBS="$PCIACCESS_LIBS -lz"],
	[AC_MSG_ERROR(Check for zlib library failed)])
	AC_CHECK_HEADER([zlib.h],
	[AC_DEFINE(HAVE_ZLIB, 1, [Use zlib to read gzip compressed pci.ids])],
	[AC_MSG_ERROR(Check for zlib.h header file failed)])
fi

case $host_os in
	*freebsd* | *dragonfly*)
		freebsd=yes
		;;
	*linux*)
		linux=yes
		;;
	*netbsd*)
		case $host in
		*i386*)
			PCIACCESS_LIBS="-li386"
			;;
		*x86_64*|*amd64*)
			PCIACCESS_LIBS="-lx86_64"
			;;
		esac
		netbsd=yes
		;;
	*openbsd*)
		openbsd=yes
		;;
	*solaris*)
		solaris=yes
		PCIACCESS_LIBS="$PCIACCESS_LIBS -ldevinfo"
		;;
esac

AM_CONDITIONAL(LINUX, [test "x$linux" = xyes])
AM_CONDITIONAL(FREEBSD, [test "x$freebsd" = xyes])
AM_CONDITIONAL(NETBSD, [test "x$netbsd" = xyes])
AM_CONDITIONAL(OPENBSD, [test "x$openbsd" = xyes])
AM_CONDITIONAL(SOLARIS, [test "x$solaris" = xyes])

AC_SYS_LARGEFILE

AC_CHECK_HEADER([asm/mtrr.h], [have_mtrr_h="yes"], [have_mtrr_h="no"])

if test "x$have_mtrr_h" = xyes; then
    AC_DEFINE(HAVE_MTRR, 1, [Use MTRRs on mappings])
fi

dnl check for the pci_io.pi_sel.pc_domain
AC_CHECK_MEMBER([struct pci_io.pi_sel.pc_domain],
               [AC_DEFINE(HAVE_PCI_IO_PC_DOMAIN,1,[Have the pci_io.pi_sel.pc_domain member.])],
               [],
               [ #include <sys/types.h>
                 #include <sys/pciio.h>
               ])

AC_SUBST(PCIACCESS_CFLAGS)
AC_SUBST(PCIACCESS_LIBS)
		  
XORG_RELEASE_VERSION
XORG_CHANGELOG

AC_OUTPUT([Makefile
	   src/Makefile
           pciaccess.pc])