configure.ac 4.23 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# (C) Copyright IBM Corporation 2006
# All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# on the rights to use, copy, modify, merge, publish, distribute, sub
# license, and/or sell copies of the Software, and to permit persons to whom
# the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
# IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
Ian Romanick's avatar
Ian Romanick committed
23

24
# Initialize Autoconf
25
AC_PREREQ([2.60])
Alan Coopersmith's avatar
Alan Coopersmith committed
26
AC_INIT([libpciaccess],[0.13.2],
27
28
29
        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=libpciaccess],[libpciaccess])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
Ian Romanick's avatar
Ian Romanick committed
30

31
# Initialize Automake
32
AM_INIT_AUTOMAKE([foreign dist-bzip2])
33
AC_USE_SYSTEM_EXTENSIONS
Ian Romanick's avatar
Ian Romanick committed
34

35
36
37
38
# Initialize libtool
AC_PROG_LIBTOOL

# Require X.Org macros 1.8 or later
39
m4_ifndef([XORG_MACROS_VERSION],
40
41
          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.8)
42
XORG_DEFAULT_OPTIONS
Ian Romanick's avatar
Ian Romanick committed
43

44
pciids_path=/usr/share/hwdata
45
AC_ARG_WITH(pciids-path, AS_HELP_STRING([--with-pciids-path=PCIIDS_PATH],
46
	[Path to pci.ids file]), [pciids_path="$withval"])
47
AX_DEFINE_DIR(PCIIDS_PATH, pciids_path, [Path to pci.ids])
Ian Romanick's avatar
Ian Romanick committed
48

49
AC_ARG_ENABLE(linux-rom-fallback, AS_HELP_STRING([--enable-linux-rom-fallback],
50
		[Enable support for falling back to /dev/mem for roms (default: disabled)]),
51
52
53
54
55
56
		[LINUX_ROM=$enableval],[LINUX_ROM=no])

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

57
use_zlib=no
58
AC_ARG_WITH(zlib, AS_HELP_STRING([--with-zlib],
59
60
	[Enable zlib support to read gzip compressed pci.ids]),
	[use_zlib="$withval"])
Kel Modderman's avatar
Kel Modderman committed
61
62
63
64
65
66
67
68
69
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

70
case $host_os in
Hasso Tepper's avatar
Hasso Tepper committed
71
	*freebsd* | *dragonfly*)
72
73
74
75
76
		freebsd=yes
		;;
	*linux*)
		linux=yes
		;;
Juan RP's avatar
Juan RP committed
77
78
79
	*netbsd*)
		case $host in
		*i386*)
Thomas Klausner's avatar
Thomas Klausner committed
80
			PCIACCESS_LIBS="$PCIACCESS_LIBS -li386 -lpci"
Juan RP's avatar
Juan RP committed
81
82
			;;
		*x86_64*|*amd64*)
Thomas Klausner's avatar
Thomas Klausner committed
83
			PCIACCESS_LIBS="$PCIACCESS_LIBS -lx86_64 -lpci"
Juan RP's avatar
Juan RP committed
84
85
86
87
			;;
		esac
		netbsd=yes
		;;
88
89
90
	*openbsd*)
		openbsd=yes
		;;
91
92
	*solaris*)
		solaris=yes
93
		PCIACCESS_LIBS="$PCIACCESS_LIBS -ldevinfo"
94
		;;
Samuel Thibault's avatar
Samuel Thibault committed
95
96
97
	gnu*)
		gnu=yes
		;;
98
99
100
101
esac

AM_CONDITIONAL(LINUX, [test "x$linux" = xyes])
AM_CONDITIONAL(FREEBSD, [test "x$freebsd" = xyes])
Juan RP's avatar
Juan RP committed
102
AM_CONDITIONAL(NETBSD, [test "x$netbsd" = xyes])
103
AM_CONDITIONAL(OPENBSD, [test "x$openbsd" = xyes])
104
AM_CONDITIONAL(SOLARIS, [test "x$solaris" = xyes])
Samuel Thibault's avatar
Samuel Thibault committed
105
AM_CONDITIONAL(GNU, [test "x$gnu" = xyes])
106

107
108
AC_SYS_LARGEFILE

109
110
AC_CHECK_HEADERS([err.h])

Thomas Klausner's avatar
Thomas Klausner committed
111
112
113
114
115
116
117
118
119
if test "x$netbsd" = xyes; then
AC_CHECK_HEADERS([machine/sysarch.h])
AC_CHECK_HEADERS([machine/mtrr.h], [have_mtrr_h="yes"], [have_mtrr_h="no"],
[#ifdef HAVE_MACHINE_SYSARCH_H
#include <sys/types.h>
#include <machine/sysarch.h>
#endif
])
else
120
AC_CHECK_HEADER([asm/mtrr.h], [have_mtrr_h="yes"], [have_mtrr_h="no"])
Thomas Klausner's avatar
Thomas Klausner committed
121
fi
122

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

127
# check for the pci_io.pi_sel.pc_domain
Petr Salinger's avatar
Petr Salinger committed
128
129
130
131
132
133
134
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>
               ])

Ian Romanick's avatar
Ian Romanick committed
135
136
AC_SUBST(PCIACCESS_CFLAGS)
AC_SUBST(PCIACCESS_LIBS)
Alan Coopersmith's avatar
Alan Coopersmith committed
137

138
AC_CONFIG_FILES([Makefile
139
140
141
142
143
		include/Makefile
		man/Makefile
		src/Makefile
		scanpci/Makefile
		pciaccess.pc])
144
AC_OUTPUT