xref: /libpciaccess/configure.ac (revision 78eed07d)
1# (C) Copyright IBM Corporation 2006
2# All Rights Reserved.
3#
4# Permission is hereby granted, free of charge, to any person obtaining a
5# copy of this software and associated documentation files (the "Software"),
6# to deal in the Software without restriction, including without limitation
7# on the rights to use, copy, modify, merge, publish, distribute, sub
8# license, and/or sell copies of the Software, and to permit persons to whom
9# the Software is furnished to do so, subject to the following conditions:
10#
11# The above copyright notice and this permission notice (including the next
12# paragraph) shall be included in all copies or substantial portions of the
13# Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
18# IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21# DEALINGS IN THE SOFTWARE.
22#
23
24# Initialize Autoconf
25AC_PREREQ([2.60])
26AC_INIT([libpciaccess],[0.12.902],
27        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=libpciaccess],[libpciaccess])
28AC_CONFIG_SRCDIR([Makefile.am])
29AC_CONFIG_HEADERS([config.h])
30
31# Initialize Automake
32AM_INIT_AUTOMAKE([foreign dist-bzip2])
33AM_MAINTAINER_MODE
34
35# Initialize libtool
36AC_PROG_LIBTOOL
37
38# Require X.Org macros 1.8 or later
39m4_ifndef([XORG_MACROS_VERSION],
40          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
41XORG_MACROS_VERSION(1.8)
42XORG_DEFAULT_OPTIONS
43
44pciids_path=/usr/share/hwdata
45AC_ARG_WITH(pciids-path, AS_HELP_STRING([--with-pciids-path=PCIIDS_PATH],
46	[Path to pci.ids file]), [pciids_path="$withval"])
47AX_DEFINE_DIR(PCIIDS_PATH, pciids_path, [Path to pci.ids])
48
49AC_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		[LINUX_ROM=$enableval],[LINUX_ROM=no])
52
53if test "x$LINUX_ROM" = xyes; then
54	AC_DEFINE(LINUX_ROM, 1, [Linux ROM read fallback])
55fi
56
57use_zlib=no
58AC_ARG_WITH(zlib, AS_HELP_STRING([--with-zlib],
59	[Enable zlib support to read gzip compressed pci.ids]),
60	[use_zlib="$withval"])
61if test "x$use_zlib" = xyes; then
62	AC_CHECK_LIB(z, gzopen,
63	[PCIACCESS_LIBS="$PCIACCESS_LIBS -lz"],
64	[AC_MSG_ERROR(Check for zlib library failed)])
65	AC_CHECK_HEADER([zlib.h],
66	[AC_DEFINE(HAVE_ZLIB, 1, [Use zlib to read gzip compressed pci.ids])],
67	[AC_MSG_ERROR(Check for zlib.h header file failed)])
68fi
69
70case $host_os in
71	*freebsd* | *dragonfly*)
72		freebsd=yes
73		;;
74	*linux*)
75		linux=yes
76		;;
77	*netbsd*)
78		case $host in
79		*i386*)
80			PCIACCESS_LIBS="-li386"
81			;;
82		*x86_64*|*amd64*)
83			PCIACCESS_LIBS="-lx86_64"
84			;;
85		esac
86		netbsd=yes
87		;;
88	*openbsd*)
89		openbsd=yes
90		;;
91	*solaris*)
92		solaris=yes
93		PCIACCESS_LIBS="$PCIACCESS_LIBS -ldevinfo"
94		;;
95	gnu*)
96		gnu=yes
97		;;
98esac
99
100AM_CONDITIONAL(LINUX, [test "x$linux" = xyes])
101AM_CONDITIONAL(FREEBSD, [test "x$freebsd" = xyes])
102AM_CONDITIONAL(NETBSD, [test "x$netbsd" = xyes])
103AM_CONDITIONAL(OPENBSD, [test "x$openbsd" = xyes])
104AM_CONDITIONAL(SOLARIS, [test "x$solaris" = xyes])
105AM_CONDITIONAL(GNU, [test "x$gnu" = xyes])
106
107AC_SYS_LARGEFILE
108
109AC_CHECK_HEADERS([err.h])
110
111AC_CHECK_HEADER([asm/mtrr.h], [have_mtrr_h="yes"], [have_mtrr_h="no"])
112
113if test "x$have_mtrr_h" = xyes; then
114    AC_DEFINE(HAVE_MTRR, 1, [Use MTRRs on mappings])
115fi
116
117# check for the pci_io.pi_sel.pc_domain
118AC_CHECK_MEMBER([struct pci_io.pi_sel.pc_domain],
119               [AC_DEFINE(HAVE_PCI_IO_PC_DOMAIN,1,[Have the pci_io.pi_sel.pc_domain member.])],
120               [],
121               [ #include <sys/types.h>
122                 #include <sys/pciio.h>
123               ])
124
125AC_SUBST(PCIACCESS_CFLAGS)
126AC_SUBST(PCIACCESS_LIBS)
127
128AC_CONFIG_FILES([Makefile
129		include/Makefile
130		man/Makefile
131		src/Makefile
132		scanpci/Makefile
133		pciaccess.pc])
134AC_OUTPUT
135