]> git.ipfire.org Git - thirdparty/pciutils.git/blame - lib/configure
Sysfs should parse 7 resources, not 8.
[thirdparty/pciutils.git] / lib / configure
CommitLineData
727ce158
MM
1#!/bin/sh
2
14d6c0a3
MM
3echo_n() {
4 if [ -n "$BASH" ]
5 then
6 echo -n "$*"
7 else
8 echo "$*\c"
9 fi
10}
11
12echo_n "Configuring libpci for your system..."
c83293eb 13sharedir=${1:-/usr/share}
727ce158
MM
14version=${2:-0.0}
15sys=`uname -s`
16rel=`uname -r`
14d6c0a3
MM
17if [ "$sys" = "AIX" -a -x /usr/bin/oslevel -a -x /usr/sbin/lsattr ]
18then
19 rel=`/usr/bin/oslevel`
20 proc=`/usr/sbin/lsdev -C -c processor -S available -F name | head -1`
21 cpu=`/usr/sbin/lsattr -F value -l $proc -a type | sed 's/_.*//'`
22else
8fc75dbc 23 cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/'`
14d6c0a3 24fi
0d656226
MM
25host=${3:-$cpu-$sys}
26host=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)$/\1--\2/' | tr 'A-Z' 'a-z'`
27cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
28sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
29rel=${4:-$rel}
30echo " $host $rel"
168b4f46 31
727ce158
MM
32c=config.h
33echo >$c "#define ARCH_`echo $cpu | tr 'a-z' 'A-Z'`"
14d6c0a3 34echo >>$c "#define OS_`echo $sys | tr 'a-z' 'A-Z'`"
168b4f46 35
14d6c0a3 36echo_n "Looking for access methods..."
168b4f46
MM
37
38case $sys in
0d656226 39 linux*)
168b4f46 40 case $rel in
11f7b31b
MM
41 2.[1-9]*|[3-9]*) echo_n "sysfs proc"
42 echo >>$c '#define HAVE_PM_LINUX_SYSFS'
168b4f46
MM
43 echo >>$c '#define HAVE_PM_LINUX_PROC'
44 echo >>$c '#define HAVE_LINUX_BYTEORDER_H'
45 echo >>$c '#define PATH_PROC_BUS_PCI "/proc/bus/pci"'
11f7b31b 46 echo >>$c '#define PATH_SYS_BUS_PCI "/sys/bus/pci"'
168b4f46
MM
47 ok=1
48 ;;
49 esac
50 case $cpu in
14d6c0a3 51 i386) echo_n " i386-ports"
168b4f46
MM
52 echo >>$c '#define HAVE_PM_INTEL_CONF'
53 ok=1
54 ;;
6aea909a 55 alpha|ia64|sparc|sparc64|ppc|ppc64)
9739916e 56 echo >>$c '#define HAVE_64BIT_ADDRESS'
168b4f46
MM
57 ;;
58 esac
59 ;;
0d656226 60 sunos)
8fc75dbc
MM
61 case $cpu in
62 i386) echo_n " i386-ports"
63 echo >>$c "#define HAVE_PM_INTEL_CONF"
64 ok=1
65 ;;
66 *)
67 echo " The PCI library is does not support Solaris for this architecture: $cpu"
68 exit 1
69 ;;
70 esac
71 ;;
72
0d656226 73 freebsd)
14d6c0a3 74 echo_n " fbsd-device"
168b4f46
MM
75 echo >>$c '#define HAVE_PM_FBSD_DEVICE'
76 echo >>$c '#define PATH_FBSD_DEVICE "/dev/pci"'
77 ok=1
78 ;;
0d656226 79 aix)
14d6c0a3
MM
80 echo_n " aix-device"
81 echo >>$c '#define HAVE_PM_AIX_DEVICE'
82 ok=1
83 ;;
0d656226 84 netbsd)
848b4347
MM
85 echo_n " nbsd-libpci"
86 echo >>$c '#define HAVE_PM_NBSD_LIBPCI'
87 echo >>$c '#define PATH_NBSD_DEVICE "/dev/pci0"'
88 ok=1
89 ;;
0d656226 90 gnu)
8fc75dbc 91 echo_n " i386-ports"
80459c65
MM
92 echo >>$c '#define HAVE_PM_INTEL_CONF'
93 ok=1
94 ;;
168b4f46 95 *)
80459c65 96 echo " Unfortunately, your OS is not supported by the PCI Library"
168b4f46
MM
97 exit 1
98 ;;
727ce158 99esac
168b4f46 100
727ce158
MM
101echo >>$c '#define HAVE_PM_DUMP'
102echo " dump"
103if [ -z "$ok" ] ; then
104 echo "WARNING: No real configuration access method is available."
105fi
c83293eb 106echo >>$c "#define PATH_PCI_IDS \"$sharedir/pci.ids\""
727ce158
MM
107echo >>$c "#define PCILIB_VERSION \"$version\""
108sed '/^#define [^ ]*$/!d;s/^#define \(.*\)/\1=1/' <$c >config.mk