-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
- ;;
- sparc) echo -n " syscalls"
- echo >>$c '#define HAVE_PM_SYSCALLS'
- ok=1
- ;;
- alpha|sparc64) echo >>$c '#define HAVE_64BIT_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
+
+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'
+ ;;
+ 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)
+ echo_n " fbsd-device"
+ echo >>$c '#define PCI_HAVE_PM_FBSD_DEVICE'
+ echo >>$c '#define PCI_PATH_FBSD_DEVICE "/dev/pci"'
+ LIBRESOLV=
+ ;;
+ openbsd)
+ echo_n " obsd-device"
+ echo >>$c '#define PCI_HAVE_PM_OBSD_DEVICE'
+ echo >>$c '#define PCI_PATH_OBSD_DEVICE "/dev/pci"'
+ LIBRESOLV=
+ ;;
+ 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 >>$m 'LIBNAME=libpciutils'
+ echo >>$m 'WITH_LIBS+=-lpci'
+ LIBRESOLV=
+ ;;
+ gnu)
+ echo_n " i386-ports"
+ echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
+ ;;
+ cygwin)
+ echo_n " i386-ports"
+ echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
+ echo >>$m 'WITH_LIBS+=-lioperm'
+ ;;
+ *)
+ echo " Unfortunately, your OS is not supported by the PCI Library"
+ exit 1
+ ;;