OSDN Git Service

Bump to 0.10.5
[android-x86/external-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_DEFINE_DIR macro from autoconf-archive.cryp.to
26 AC_DEFUN([AC_DEFINE_DIR], [
27   prefix_NONE=
28   exec_prefix_NONE=
29   test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
30   test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
31 dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
32 dnl refers to ${prefix}.  Thus we have to use `eval' twice.
33   eval ac_define_dir="\"[$]$2\""
34   eval ac_define_dir="\"$ac_define_dir\""
35   AC_SUBST($1, "$ac_define_dir")
36   AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
37   test "$prefix_NONE" && prefix=NONE
38   test "$exec_prefix_NONE" && exec_prefix=NONE
39 ])
40
41 AC_PREREQ([2.57])
42
43 AC_INIT(libpciaccess, 0.10.5, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=libpciaccess], libpciaccess)
44 AM_INIT_AUTOMAKE([dist-bzip2])
45 AM_MAINTAINER_MODE
46
47 AM_CONFIG_HEADER(config.h)
48
49 # Check for progs
50 AC_PROG_CC
51 AC_PROG_LIBTOOL
52
53 m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
54
55 DEFAULT_PCIIDS_PATH=/usr/share/hwdata
56 AC_ARG_WITH(pciids-path,
57         AS_HELP_STRING([--with-pciids-path=PCIIDS_PATH], [Path to pci.ids file]),
58         [PCIIDS_PATH="$withval"],
59         [PCIIDS_PATH="$DEFAULT_PCIIDS_PATH"])
60 AC_DEFINE_DIR(PCIIDS_PATH, PCIIDS_PATH, [Path to pci.ids])
61
62 AC_ARG_WITH(zlib,
63         AS_HELP_STRING([--with-zlib], [Enable zlib support to read gzip compressed pci.ids]),
64         [use_zlib="$withval"],
65         [use_zlib="no"])
66 if test "x$use_zlib" = xyes; then
67         AC_CHECK_LIB(z, gzopen,
68         [PCIACCESS_LIBS="$PCIACCESS_LIBS -lz"],
69         [AC_MSG_ERROR(Check for zlib library failed)])
70         AC_CHECK_HEADER([zlib.h],
71         [AC_DEFINE(HAVE_ZLIB, 1, [Use zlib to read gzip compressed pci.ids])],
72         [AC_MSG_ERROR(Check for zlib.h header file failed)])
73 fi
74
75 if test "x$GCC" = "xyes"; then
76        GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes"
77        GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations"
78        GCC_WARNINGS3="-Wnested-externs"
79        GCC_WARNINGS="$GCC_WARNINGS1 $GCC_WARNINGS2 $GCC_WARNINGS3"
80        if test "x$WERROR" = "xyes"; then
81                GCC_WARNINGS="${GCC_WARNINGS} -Werror"
82        fi
83        PCIACCESS_CFLAGS="$PCIACCESS_CFLAGS $GCC_WARNINGS"
84 fi
85
86 case $host_os in
87         *freebsd* | *dragonfly*)
88                 freebsd=yes
89                 ;;
90         *linux*)
91                 linux=yes
92                 ;;
93         *netbsd*)
94                 case $host in
95                 *i386*)
96                         PCIACCESS_LIBS="-li386"
97                         ;;
98                 *x86_64*|*amd64*)
99                         PCIACCESS_LIBS="-lx86_64"
100                         ;;
101                 esac
102                 netbsd=yes
103                 ;;
104         *openbsd*)
105                 openbsd=yes
106                 ;;
107         *solaris*)
108                 solaris=yes
109                 PCIACCESS_LIBS="$PCIACCESS_LIBS -ldevinfo"
110                 ;;
111 esac
112
113 AM_CONDITIONAL(LINUX, [test "x$linux" = xyes])
114 AM_CONDITIONAL(FREEBSD, [test "x$freebsd" = xyes])
115 AM_CONDITIONAL(NETBSD, [test "x$netbsd" = xyes])
116 AM_CONDITIONAL(OPENBSD, [test "x$openbsd" = xyes])
117 AM_CONDITIONAL(SOLARIS, [test "x$solaris" = xyes])
118
119 AC_CHECK_HEADER([asm/mtrr.h], [have_mtrr_h="yes"], [have_mtrr_h="no"])
120
121 if test "x$have_mtrr_h" = xyes; then
122     AC_DEFINE(HAVE_MTRR, 1, [Use MTRRs on mappings])
123 fi
124
125 dnl check for the pci_io.pi_sel.pc_domain
126 AC_CHECK_MEMBER([struct pci_io.pi_sel.pc_domain],
127                [AC_DEFINE(HAVE_PCI_IO_PC_DOMAIN,1,[Have the pci_io.pi_sel.pc_domain member.])],
128                [],
129                [ #include <sys/types.h>
130                  #include <sys/pciio.h>
131                ])
132
133 AC_SUBST(PCIACCESS_CFLAGS)
134 AC_SUBST(PCIACCESS_LIBS)
135                   
136 XORG_RELEASE_VERSION
137
138 AC_OUTPUT([Makefile
139            src/Makefile
140            pciaccess.pc])