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