-echo >$c "#define ARCH_`echo $cpu | tr 'a-z' 'A-Z'`"
-case $rel in
- 2.[1-9]*|[3-9]*) echo -n " proc"
- echo >>$c '#define HAVE_PM_LINUX_PROC'
- echo >>$c '#define HAVE_LINUX_BYTEORDER_H'
- echo >>$c '#define PATH_PROC_BUS_PCI "/proc/bus/pci"'
- ok=1
- ;;
-esac
-case $cpu in
- i386) echo -n " i386-ports"
- echo >>$c '#define HAVE_PM_INTEL_CONF'
- ok=1
- ;;
- alpha) echo >>$c '#define HAVE_64BIT_ADDRESS'
-# echo -n " syscalls"
-# echo >>$c '#define HAVE_PM_SYSCALLS'
-# ok=1
- ;;
- sparc|sparc64) echo >>$c '#define HAVE_64BIT_ADDRESS'
- echo >>$c '#define HAVE_LONG_ADDRESS'
-# echo -n " syscalls"
-# echo >>$c '#define HAVE_PM_SYSCALLS'
-# ok=1
- ;;
+m=config.mk
+echo >$c '#define PCI_CONFIG_H'
+echo >>$c "#define PCI_ARCH_`echo $cpu | tr '[a-z]' '[A-Z]'`"
+echo >>$c "#define PCI_OS_`echo $sys | tr '[a-z]' '[A-Z]'`"
+echo >$m 'WITH_LIBS='
+
+echo_n "Looking for access methods..."
+LIBRESOLV=-lresolv
+LIBEXT=so
+EXEEXT=
+SYSINCLUDE=/usr/include
+LSPCIDIR=SBINDIR
+
+case $sys in
+ linux*)
+ echo_n " sysfs proc"
+ echo >>$c '#define PCI_HAVE_PM_LINUX_SYSFS'
+ echo >>$c '#define PCI_HAVE_PM_LINUX_PROC'
+ echo >>$c '#define PCI_HAVE_LINUX_BYTEORDER_H'
+ echo >>$c '#define PCI_PATH_PROC_BUS_PCI "/proc/bus/pci"'
+ echo >>$c '#define PCI_PATH_SYS_BUS_PCI "/sys/bus/pci"'
+ case $cpu in
+ i?86|x86_64) echo_n " i386-ports"
+ echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
+ ;;
+ esac
+ echo >>$c '#define PCI_HAVE_64BIT_ADDRESS'
+ LSPCIDIR=BINDIR
+ ;;
+ sunos)
+ case $cpu in
+ i?86) echo_n " i386-ports"
+ echo >>$c "#define PCI_HAVE_PM_INTEL_CONF"
+ ;;
+ *)
+ echo " The PCI library does not support Solaris for this architecture: $cpu"
+ exit 1
+ ;;
+ esac
+ echo >>$c '#define PCI_HAVE_STDINT_H'
+ ;;
+ freebsd*|kfreebsd*)
+ echo_n " fbsd-device"
+ echo >>$c '#define PCI_HAVE_PM_FBSD_DEVICE'
+ echo >>$c '#define PCI_PATH_FBSD_DEVICE "/dev/pci"'
+ if [ "$sys" != "kfreebsd" ] ; then
+ LIBRESOLV=
+ fi
+ ;;
+ openbsd)
+ echo_n " obsd-device"
+ echo >>$c '#define PCI_HAVE_PM_OBSD_DEVICE'
+ echo >>$c '#define PCI_PATH_OBSD_DEVICE "/dev/pci"'
+ LIBRESOLV=
+ ;;
+
+ darwin*)
+ echo_n " darwin"
+ echo >>$c '#define PCI_HAVE_PM_DARWIN_DEVICE'
+ echo >>$m 'WITH_LIBS+=-lresolv -framework CoreFoundation -framework IOKit'
+ echo >>$c '#define PCI_HAVE_64BIT_ADDRESS'
+ LIBRESOLV=
+ LIBEXT=dylib
+ SYSINCLUDE=$(xcrun --sdk macosx --show-sdk-path)/usr/include
+ ;;
+ aix)
+ echo_n " aix-device"
+ echo >>$c '#define PCI_HAVE_PM_AIX_DEVICE'
+ echo >>$m 'CFLAGS=-g'
+ echo >>$m 'INSTALL=installbsd'
+ echo >>$m 'DIRINSTALL=mkdir -p'
+ ;;
+ netbsd)
+ echo_n " nbsd-libpci"
+ echo >>$c '#define PCI_HAVE_PM_NBSD_LIBPCI'
+ echo >>$c '#define PCI_PATH_NBSD_DEVICE "/dev/pci0"'
+ echo >>$c '#define PCI_HAVE_64BIT_ADDRESS'
+ echo >>$m 'LIBNAME=libpciutils'
+ echo >>$m 'WITH_LIBS+=-lpci'
+ LIBRESOLV=
+ ;;
+ gnu)
+ echo_n " hurd i386-ports"
+ echo >>$c '#define PCI_HAVE_PM_HURD_CONF'
+ echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
+ ;;
+ djgpp)
+ echo_n " i386-ports"
+ echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
+ EXEEXT=.exe
+ ;;
+ cygwin|windows)
+ echo_n " win32-cfgmgr32"
+ echo >>$c '#define PCI_HAVE_64BIT_ADDRESS'
+ echo >>$c '#define PCI_HAVE_PM_WIN32_CFGMGR32'
+ # Warning: MinGW-w64 (incorrectly) provides cfgmgr32 functions
+ # also in other import libraries, not only in libcfgmgr32.a.
+ # So always set -lcfgmgr32 as a first library parameter which
+ # instruct linker to prefer symbols from cfgmgr32.dll.
+ echo >>$m 'WITH_LIBS+=-lcfgmgr32'
+ case $cpu in i?86|x86_64)
+ echo_n " i386-ports"
+ echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
+ if [ "$sys" = "cygwin" ] ; then
+ # ioperm is cygwin specific library and used only by lib/i386-io-cygwin.h
+ echo >>$m 'WITH_LIBS+=-lioperm'
+ elif [ "$sys" = "windows" ] ; then
+ # advapi32 is windows system library and used only by lib/i386-io-windows.h
+ echo >>$m 'WITH_LIBS+=-ladvapi32'
+ fi
+ ;; esac
+ EXEEXT=.exe
+ ;;
+ beos|haiku)
+ case $cpu in
+ i?86|x86_64) echo_n " i386-ports"
+ echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
+ ;;
+ esac
+ echo >>$c '#define PCI_HAVE_STDINT_H'
+ ;;
+ sylixos)
+ echo >>$c '#define PCI_PATH_SYLIXOS_DEVICE "/proc/pci"'
+ echo >>$c '#define PCI_HAVE_64BIT_ADDRESS'
+ echo >>$c '#define PCI_HAVE_PM_SYLIXOS_DEVICE'
+ IDSDIR="/etc/pci"
+ LIBRESOLV=
+ ;;
+ *)
+ echo " Unfortunately, your OS is not supported by the PCI Library"
+ exit 1
+ ;;