]> git.ipfire.org Git - thirdparty/pciutils.git/blame - lib/configure
Fixed calls to config_fetch()
[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
23 cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/'`
24fi
25echo " $sys/$cpu $rel"
168b4f46 26
727ce158
MM
27c=config.h
28echo >$c "#define ARCH_`echo $cpu | tr 'a-z' 'A-Z'`"
14d6c0a3 29echo >>$c "#define OS_`echo $sys | tr 'a-z' 'A-Z'`"
168b4f46 30
14d6c0a3 31echo_n "Looking for access methods..."
168b4f46
MM
32
33case $sys in
34 Linux)
35 case $rel in
14d6c0a3 36 2.[1-9]*|[3-9]*) echo_n " proc"
168b4f46
MM
37 echo >>$c '#define HAVE_PM_LINUX_PROC'
38 echo >>$c '#define HAVE_LINUX_BYTEORDER_H'
39 echo >>$c '#define PATH_PROC_BUS_PCI "/proc/bus/pci"'
40 ok=1
41 ;;
42 esac
43 case $cpu in
14d6c0a3 44 i386) echo_n " i386-ports"
168b4f46
MM
45 echo >>$c '#define HAVE_PM_INTEL_CONF'
46 ok=1
47 ;;
2dfd48cd 48 alpha|ia64) echo >>$c '#define HAVE_64BIT_ADDRESS'
168b4f46
MM
49 ;;
50 sparc|sparc64) echo >>$c '#define HAVE_64BIT_ADDRESS'
51 echo >>$c '#define HAVE_LONG_ADDRESS'
168b4f46
MM
52 ;;
53 esac
54 ;;
55 FreeBSD)
14d6c0a3 56 echo_n " fbsd-device"
168b4f46
MM
57 echo >>$c '#define HAVE_PM_FBSD_DEVICE'
58 echo >>$c '#define PATH_FBSD_DEVICE "/dev/pci"'
59 ok=1
60 ;;
14d6c0a3
MM
61 AIX)
62 echo_n " aix-device"
63 echo >>$c '#define HAVE_PM_AIX_DEVICE'
64 ok=1
65 ;;
848b4347
MM
66 NetBSD)
67 echo_n " nbsd-libpci"
68 echo >>$c '#define HAVE_PM_NBSD_LIBPCI'
69 echo >>$c '#define PATH_NBSD_DEVICE "/dev/pci0"'
70 ok=1
71 ;;
168b4f46 72 *)
848b4347 73 echo " The PCI library currently supports only Linux, AIX, FreeBSD and NetBSD"
168b4f46
MM
74 exit 1
75 ;;
727ce158 76esac
168b4f46 77
727ce158
MM
78echo >>$c '#define HAVE_PM_DUMP'
79echo " dump"
80if [ -z "$ok" ] ; then
81 echo "WARNING: No real configuration access method is available."
82fi
c83293eb 83echo >>$c "#define PATH_PCI_IDS \"$sharedir/pci.ids\""
727ce158
MM
84echo >>$c "#define PCILIB_VERSION \"$version\""
85sed '/^#define [^ ]*$/!d;s/^#define \(.*\)/\1=1/' <$c >config.mk