1f3e283a2SGaetan Nadon# (C) Copyright IBM Corporation 2006 2f3e283a2SGaetan Nadon# All Rights Reserved. 3f3e283a2SGaetan Nadon# 4f3e283a2SGaetan Nadon# Permission is hereby granted, free of charge, to any person obtaining a 5f3e283a2SGaetan Nadon# copy of this software and associated documentation files (the "Software"), 6f3e283a2SGaetan Nadon# to deal in the Software without restriction, including without limitation 7f3e283a2SGaetan Nadon# on the rights to use, copy, modify, merge, publish, distribute, sub 8f3e283a2SGaetan Nadon# license, and/or sell copies of the Software, and to permit persons to whom 9f3e283a2SGaetan Nadon# the Software is furnished to do so, subject to the following conditions: 10f3e283a2SGaetan Nadon# 11f3e283a2SGaetan Nadon# The above copyright notice and this permission notice (including the next 12f3e283a2SGaetan Nadon# paragraph) shall be included in all copies or substantial portions of the 13f3e283a2SGaetan Nadon# Software. 14f3e283a2SGaetan Nadon# 15f3e283a2SGaetan Nadon# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16f3e283a2SGaetan Nadon# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17f3e283a2SGaetan Nadon# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18f3e283a2SGaetan Nadon# IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19f3e283a2SGaetan Nadon# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20f3e283a2SGaetan Nadon# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21f3e283a2SGaetan Nadon# DEALINGS IN THE SOFTWARE. 22f3e283a2SGaetan Nadon# 235a04522aSIan Romanick 2448d08f09SAlan Coopersmith# Initialize Autoconf 25b8295f47SGaetan NadonAC_PREREQ([2.60]) 26*78eed07dSJeremy HuddlestonAC_INIT([libpciaccess],[0.12.902], 2748d08f09SAlan Coopersmith [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=libpciaccess],[libpciaccess]) 2848d08f09SAlan CoopersmithAC_CONFIG_SRCDIR([Makefile.am]) 2948d08f09SAlan CoopersmithAC_CONFIG_HEADERS([config.h]) 305a04522aSIan Romanick 3148d08f09SAlan Coopersmith# Initialize Automake 3257f4d11fSGaetan NadonAM_INIT_AUTOMAKE([foreign dist-bzip2]) 335a04522aSIan RomanickAM_MAINTAINER_MODE 345a04522aSIan Romanick 35f3e283a2SGaetan Nadon# Initialize libtool 365a04522aSIan RomanickAC_PROG_LIBTOOL 375a04522aSIan Romanick 38f3e283a2SGaetan Nadon# Require X.Org macros 1.8 or later 39f3e283a2SGaetan Nadonm4_ifndef([XORG_MACROS_VERSION], 40f3e283a2SGaetan Nadon [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) 41f3e283a2SGaetan NadonXORG_MACROS_VERSION(1.8) 42f3e283a2SGaetan NadonXORG_DEFAULT_OPTIONS 43f3e283a2SGaetan Nadon 4442b49349SPaulo Cesar Pereira de Andradepciids_path=/usr/share/hwdata 457b4bd822SGaetan NadonAC_ARG_WITH(pciids-path, AS_HELP_STRING([--with-pciids-path=PCIIDS_PATH], 4642b49349SPaulo Cesar Pereira de Andrade [Path to pci.ids file]), [pciids_path="$withval"]) 4755577296SGaetan NadonAX_DEFINE_DIR(PCIIDS_PATH, pciids_path, [Path to pci.ids]) 485a04522aSIan Romanick 49dedd31b3SDave AirlieAC_ARG_ENABLE(linux-rom-fallback, AS_HELP_STRING([--enable-linux-rom-fallback], 504eac0173SJulien Cristau [Enable support for falling back to /dev/mem for roms (default: disabled)]), 51dedd31b3SDave Airlie [LINUX_ROM=$enableval],[LINUX_ROM=no]) 52dedd31b3SDave Airlie 53dedd31b3SDave Airlieif test "x$LINUX_ROM" = xyes; then 54dedd31b3SDave Airlie AC_DEFINE(LINUX_ROM, 1, [Linux ROM read fallback]) 55dedd31b3SDave Airliefi 56dedd31b3SDave Airlie 5742b49349SPaulo Cesar Pereira de Andradeuse_zlib=no 587b4bd822SGaetan NadonAC_ARG_WITH(zlib, AS_HELP_STRING([--with-zlib], 5942b49349SPaulo Cesar Pereira de Andrade [Enable zlib support to read gzip compressed pci.ids]), 6042b49349SPaulo Cesar Pereira de Andrade [use_zlib="$withval"]) 6145015ab3SKel Moddermanif test "x$use_zlib" = xyes; then 6245015ab3SKel Modderman AC_CHECK_LIB(z, gzopen, 6345015ab3SKel Modderman [PCIACCESS_LIBS="$PCIACCESS_LIBS -lz"], 6445015ab3SKel Modderman [AC_MSG_ERROR(Check for zlib library failed)]) 6545015ab3SKel Modderman AC_CHECK_HEADER([zlib.h], 6645015ab3SKel Modderman [AC_DEFINE(HAVE_ZLIB, 1, [Use zlib to read gzip compressed pci.ids])], 6745015ab3SKel Modderman [AC_MSG_ERROR(Check for zlib.h header file failed)]) 6845015ab3SKel Moddermanfi 6945015ab3SKel Modderman 7007b09d93SEric Anholtcase $host_os in 71a3b63c43SHasso Tepper *freebsd* | *dragonfly*) 7207b09d93SEric Anholt freebsd=yes 7307b09d93SEric Anholt ;; 7407b09d93SEric Anholt *linux*) 7507b09d93SEric Anholt linux=yes 7607b09d93SEric Anholt ;; 774c1c607cSJuan RP *netbsd*) 784c1c607cSJuan RP case $host in 794c1c607cSJuan RP *i386*) 804c1c607cSJuan RP PCIACCESS_LIBS="-li386" 814c1c607cSJuan RP ;; 824c1c607cSJuan RP *x86_64*|*amd64*) 834c1c607cSJuan RP PCIACCESS_LIBS="-lx86_64" 844c1c607cSJuan RP ;; 854c1c607cSJuan RP esac 864c1c607cSJuan RP netbsd=yes 874c1c607cSJuan RP ;; 88d898072eSMark Kettenis *openbsd*) 89d898072eSMark Kettenis openbsd=yes 90d898072eSMark Kettenis ;; 91206e2921Sedward shu *solaris*) 92206e2921Sedward shu solaris=yes 934bdaca52SAlan Coopersmith PCIACCESS_LIBS="$PCIACCESS_LIBS -ldevinfo" 94206e2921Sedward shu ;; 95af2be749SSamuel Thibault gnu*) 96af2be749SSamuel Thibault gnu=yes 97af2be749SSamuel Thibault ;; 9807b09d93SEric Anholtesac 9907b09d93SEric Anholt 10007b09d93SEric AnholtAM_CONDITIONAL(LINUX, [test "x$linux" = xyes]) 10107b09d93SEric AnholtAM_CONDITIONAL(FREEBSD, [test "x$freebsd" = xyes]) 1024c1c607cSJuan RPAM_CONDITIONAL(NETBSD, [test "x$netbsd" = xyes]) 103d898072eSMark KettenisAM_CONDITIONAL(OPENBSD, [test "x$openbsd" = xyes]) 104206e2921Sedward shuAM_CONDITIONAL(SOLARIS, [test "x$solaris" = xyes]) 105af2be749SSamuel ThibaultAM_CONDITIONAL(GNU, [test "x$gnu" = xyes]) 10607b09d93SEric Anholt 107613c1e6dSAlan CoopersmithAC_SYS_LARGEFILE 108613c1e6dSAlan Coopersmith 109b9c5ce80SJeremy HuddlestonAC_CHECK_HEADERS([err.h]) 110b9c5ce80SJeremy Huddleston 111968289fcSJohn TapsellAC_CHECK_HEADER([asm/mtrr.h], [have_mtrr_h="yes"], [have_mtrr_h="no"]) 112968289fcSJohn Tapsell 11308ff9f7fSIan Romanickif test "x$have_mtrr_h" = xyes; then 11408ff9f7fSIan Romanick AC_DEFINE(HAVE_MTRR, 1, [Use MTRRs on mappings]) 11508ff9f7fSIan Romanickfi 11608ff9f7fSIan Romanick 117f3e283a2SGaetan Nadon# check for the pci_io.pi_sel.pc_domain 1186ae37861SPetr SalingerAC_CHECK_MEMBER([struct pci_io.pi_sel.pc_domain], 1196ae37861SPetr Salinger [AC_DEFINE(HAVE_PCI_IO_PC_DOMAIN,1,[Have the pci_io.pi_sel.pc_domain member.])], 1206ae37861SPetr Salinger [], 1216ae37861SPetr Salinger [ #include <sys/types.h> 1226ae37861SPetr Salinger #include <sys/pciio.h> 1236ae37861SPetr Salinger ]) 1246ae37861SPetr Salinger 1255a04522aSIan RomanickAC_SUBST(PCIACCESS_CFLAGS) 1265a04522aSIan RomanickAC_SUBST(PCIACCESS_LIBS) 1275a04522aSIan Romanick 12848d08f09SAlan CoopersmithAC_CONFIG_FILES([Makefile 129fd476deaSGaetan Nadon include/Makefile 130b4ee1ccfSGaetan Nadon man/Makefile 1315a04522aSIan Romanick src/Makefile 132dcb79a20SGaetan Nadon scanpci/Makefile 1335a04522aSIan Romanick pciaccess.pc]) 13448d08f09SAlan CoopersmithAC_OUTPUT 135