]> mj.ucw.cz Git - pciutils.git/blob - lib/configure
84afe121a2fd3b6a71fc714017258295838c0244
[pciutils.git] / lib / configure
1 #!/bin/sh
2
3 echo -n "Configuring libpci for your system..."
4 prefix=${1:-/usr}
5 version=${2:-0.0}
6 sys=`uname -s`
7 rel=`uname -r`
8 cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/'`
9 echo "$sys/$cpu $rel"
10
11 c=config.h
12 echo >$c "#define ARCH_`echo $cpu | tr 'a-z' 'A-Z'`"
13 echo >$c "#define OS_`echo $sys | tr 'a-z' 'A-Z'`"
14
15 echo -n "Looking for access methods..."
16
17 case $sys in
18         Linux)
19                 case $rel in
20                         2.[1-9]*|[3-9]*)        echo -n " proc"
21                                                 echo >>$c '#define HAVE_PM_LINUX_PROC'
22                                                 echo >>$c '#define HAVE_LINUX_BYTEORDER_H'
23                                                 echo >>$c '#define PATH_PROC_BUS_PCI "/proc/bus/pci"'
24                                                 ok=1
25                                                 ;;
26                 esac
27                 case $cpu in
28                                 i386)           echo -n " i386-ports"
29                                                 echo >>$c '#define HAVE_PM_INTEL_CONF'
30                                                 ok=1
31                                                 ;;
32                                 alpha)          echo >>$c '#define HAVE_64BIT_ADDRESS'
33 #                                               echo -n " syscalls"
34 #                                               echo >>$c '#define HAVE_PM_SYSCALLS'
35 #                                               ok=1
36                                                 ;;
37                                 sparc|sparc64)  echo >>$c '#define HAVE_64BIT_ADDRESS'
38                                                 echo >>$c '#define HAVE_LONG_ADDRESS'
39 #                                               echo -n " syscalls"
40 #                                               echo >>$c '#define HAVE_PM_SYSCALLS'
41 #                                               ok=1
42                                                 ;;
43                 esac
44                 ;;
45         FreeBSD)
46                 echo -n " fbsd-device"
47                 echo >>$c '#define HAVE_PM_FBSD_DEVICE'
48                 echo >>$c '#define PATH_FBSD_DEVICE "/dev/pci"'
49                 ok=1
50                 ;;
51         *)
52                 echo " The PCI library currently supports only Linux and FreeBSD"
53                 exit 1
54                 ;;
55 esac
56
57 echo >>$c '#define HAVE_PM_DUMP'
58 echo " dump"
59 if [ -z "$ok" ] ; then
60         echo "WARNING: No real configuration access method is available."
61 fi
62 echo >>$c "#define PATH_PCI_IDS \"$prefix/share/pci.ids\""
63 if [ -f header.h ] ; then
64         echo >>$c '#define HAVE_OWN_HEADER_H'
65 fi
66 echo >>$c "#define PCILIB_VERSION \"$version\""
67 sed '/^#define [^ ]*$/!d;s/^#define \(.*\)/\1=1/' <$c >config.mk