OSDN Git Service

Android porting
[android-x86/external-libpciaccess.git] / configure.ac
index 133963d..888330b 100644 (file)
+# (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.
+#
 
-dnl (C) Copyright IBM Corporation 2006
-dnl All Rights Reserved.
-dnl
-dnl Permission is hereby granted, free of charge, to any person obtaining a
-dnl copy of this software and associated documentation files (the "Software"),
-dnl to deal in the Software without restriction, including without limitation
-dnl on the rights to use, copy, modify, merge, publish, distribute, sub
-dnl license, and/or sell copies of the Software, and to permit persons to whom
-dnl the Software is furnished to do so, subject to the following conditions:
-dnl
-dnl The above copyright notice and this permission notice (including the next
-dnl paragraph) shall be included in all copies or substantial portions of the
-dnl Software.
-dnl
-dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-dnl FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
-dnl IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-dnl DEALINGS IN THE SOFTWARE.
-dnl
-dnl Process this file with autoconf to create configure.
-
-# AC_DEFINE_DIR macro from autoconf-archive.cryp.to
-AC_DEFUN([AC_DEFINE_DIR], [
-  prefix_NONE=
-  exec_prefix_NONE=
-  test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
-  test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
-dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
-dnl refers to ${prefix}.  Thus we have to use `eval' twice.
-  eval ac_define_dir="\"[$]$2\""
-  eval ac_define_dir="\"$ac_define_dir\""
-  AC_SUBST($1, "$ac_define_dir")
-  AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
-  test "$prefix_NONE" && prefix=NONE
-  test "$exec_prefix_NONE" && exec_prefix=NONE
-])
+# Initialize Autoconf
+AC_PREREQ([2.60])
+AC_INIT([libpciaccess],[0.13.4],
+        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=libpciaccess],[libpciaccess])
+AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_HEADERS([config.h])
+
+# Initialize Automake
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AC_USE_SYSTEM_EXTENSIONS
 
-AC_PREREQ([2.57])
+# Initialize libtool
+AC_PROG_LIBTOOL
 
-AC_INIT(libpciaccess, 0.10.0, [none yet], libpciaccess)
-AM_INIT_AUTOMAKE([dist-bzip2])
-AM_MAINTAINER_MODE
+# Require X.Org macros 1.8 or later
+m4_ifndef([XORG_MACROS_VERSION],
+          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.8)
+XORG_DEFAULT_OPTIONS
 
-AM_CONFIG_HEADER(config.h)
+pciids_path=/usr/share/hwdata
+AC_ARG_WITH(pciids-path, AS_HELP_STRING([--with-pciids-path=PCIIDS_PATH],
+       [Path to pci.ids file]), [pciids_path="$withval"])
+AX_DEFINE_DIR(PCIIDS_PATH, pciids_path, [Path to pci.ids])
 
-# Check for progs
-AC_PROG_CC
-AC_PROG_LIBTOOL
+AC_ARG_ENABLE(linux-rom-fallback, AS_HELP_STRING([--enable-linux-rom-fallback],
+               [Enable support for falling back to /dev/mem for roms (default: disabled)]),
+               [LINUX_ROM=$enableval],[LINUX_ROM=no])
 
-m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
-
-DEFAULT_PCIIDS_PATH=/usr/share/hwdata
-AC_ARG_WITH(pciids-path,
-       AS_HELP_STRING([--with-pciids-path=PCIIDS_PATH], [Path to pci.ids file]),
-       [PCIIDS_PATH="$withval"],
-       [PCIIDS_PATH="$DEFAULT_PCIIDS_PATH"])
-AC_DEFINE_DIR(PCIIDS_PATH, PCIIDS_PATH, [Path to pci.ids])
-
-if test "x$GCC" = "xyes"; then
-       GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes"
-       GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations"
-       GCC_WARNINGS3="-Wnested-externs"
-       GCC_WARNINGS="$GCC_WARNINGS1 $GCC_WARNINGS2 $GCC_WARNINGS3"
-       if test "x$WERROR" = "xyes"; then
-               GCC_WARNINGS="${GCC_WARNINGS} -Werror"
-       fi
-       PCIACCESS_CFLAGS="$PCIACCESS_CFLAGS $GCC_WARNINGS"
+if test "x$LINUX_ROM" = xyes; then
+       AC_DEFINE(LINUX_ROM, 1, [Linux ROM read fallback])
+fi
+
+use_zlib=no
+AC_ARG_WITH(zlib, AS_HELP_STRING([--with-zlib],
+       [Enable zlib support to read gzip compressed pci.ids]),
+       [use_zlib="$withval"])
+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
 
 case $host_os in
-       *freebsd*)
+       *freebsd* | *dragonfly*)
                freebsd=yes
                ;;
        *linux*)
                linux=yes
                ;;
+       *netbsd*)
+               case $host in
+               *i[[3-9]]86*)
+                       PCIACCESS_LIBS="$PCIACCESS_LIBS -li386"
+                       ;;
+               *x86_64*|*amd64*)
+                       PCIACCESS_LIBS="$PCIACCESS_LIBS -lx86_64"
+                       ;;
+               *alpha*)
+                       PCIACCESS_LIBS="$PCIACCESS_LIBS -lalpha"
+                       ;;
+               esac
+               PCIACCESS_LIBS="$PCIACCESS_LIBS -lpci"
+               netbsd=yes
+               ;;
+       *openbsd*)
+               openbsd=yes
+               ;;
        *solaris*)
                solaris=yes
+               PCIACCESS_LIBS="$PCIACCESS_LIBS -ldevinfo"
+               ;;
+       gnu*)
+               gnu=yes
+               ;;
+       *cygwin*)
+               cygwin=yes
+               PCIACCESS_LIBS="$PCIACCESS_LIBS"
                ;;
 esac
 
 AM_CONDITIONAL(LINUX, [test "x$linux" = xyes])
 AM_CONDITIONAL(FREEBSD, [test "x$freebsd" = xyes])
+AM_CONDITIONAL(NETBSD, [test "x$netbsd" = xyes])
+AM_CONDITIONAL(OPENBSD, [test "x$openbsd" = xyes])
 AM_CONDITIONAL(SOLARIS, [test "x$solaris" = xyes])
+AM_CONDITIONAL(GNU, [test "x$gnu" = xyes])
+AM_CONDITIONAL(CYGWIN, [test "x$cygwin" = xyes])
+
+AC_SYS_LARGEFILE
+
+AC_CHECK_HEADERS([err.h])
+
+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
+AC_CHECK_HEADER([asm/mtrr.h], [have_mtrr_h="yes"], [have_mtrr_h="no"])
+fi
 
-AC_CHECK_FILE([/usr/include/asm/mtrr.h],
-              [have_mtrr_h="yes"], [have_mtrr_h="no"])
 if test "x$have_mtrr_h" = xyes; then
     AC_DEFINE(HAVE_MTRR, 1, [Use MTRRs on mappings])
 fi
 
+# check for the pci_io.pi_sel.pc_domain
+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>
+               ])
+
 AC_SUBST(PCIACCESS_CFLAGS)
 AC_SUBST(PCIACCESS_LIBS)
-                 
-XORG_RELEASE_VERSION
 
-AC_OUTPUT([Makefile
-          src/Makefile
-           pciaccess.pc])
+AC_CONFIG_FILES([Makefile
+               include/Makefile
+               man/Makefile
+               src/Makefile
+               scanpci/Makefile
+               pciaccess.pc])
+AC_OUTPUT