]> mj.ucw.cz Git - pciutils.git/blob - lib/configure
HAVE_OWN_HEADER_H is gone.
[pciutils.git] / lib / configure
1 #!/bin/sh
2
3 echo_n() {
4         if [ -n "$BASH" ]
5         then
6                 echo -n "$*"
7         else
8                 echo "$*\c"
9         fi
10 }
11
12 echo_n "Configuring libpci for your system..."
13 prefix=${1:-/usr}
14 version=${2:-0.0}
15 sys=`uname -s`
16 rel=`uname -r`
17 if [ "$sys" = "AIX" -a -x /usr/bin/oslevel -a -x /usr/sbin/lsattr ]
18 then
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/_.*//'`
22 else
23         cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/'`
24 fi
25 echo " $sys/$cpu $rel"
26
27 c=config.h
28 echo >$c "#define ARCH_`echo $cpu | tr 'a-z' 'A-Z'`"
29 echo >>$c "#define OS_`echo $sys | tr 'a-z' 'A-Z'`"
30
31 echo_n "Looking for access methods..."
32
33 case $sys in
34         Linux)
35                 case $rel in
36                         2.[1-9]*|[3-9]*)        echo_n " proc"
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
44                                 i386)           echo_n " i386-ports"
45                                                 echo >>$c '#define HAVE_PM_INTEL_CONF'
46                                                 ok=1
47                                                 ;;
48                                 alpha|ia64)     echo >>$c '#define HAVE_64BIT_ADDRESS'
49 #                                               echo_n " syscalls"
50 #                                               echo >>$c '#define HAVE_PM_SYSCALLS'
51 #                                               ok=1
52                                                 ;;
53                                 sparc|sparc64)  echo >>$c '#define HAVE_64BIT_ADDRESS'
54                                                 echo >>$c '#define HAVE_LONG_ADDRESS'
55 #                                               echo_n " syscalls"
56 #                                               echo >>$c '#define HAVE_PM_SYSCALLS'
57 #                                               ok=1
58                                                 ;;
59                 esac
60                 ;;
61         FreeBSD)
62                 echo_n " fbsd-device"
63                 echo >>$c '#define HAVE_PM_FBSD_DEVICE'
64                 echo >>$c '#define PATH_FBSD_DEVICE "/dev/pci"'
65                 ok=1
66                 ;;
67         AIX)
68                 echo_n " aix-device"
69                 echo >>$c '#define HAVE_PM_AIX_DEVICE'
70                 ok=1
71                 ;;
72         NetBSD)
73                 echo_n " nbsd-libpci"
74                 echo >>$c '#define HAVE_PM_NBSD_LIBPCI'
75                 echo >>$c '#define PATH_NBSD_DEVICE "/dev/pci0"'
76                 ok=1
77                 ;;
78         *)
79                 echo " The PCI library currently supports only Linux, AIX, FreeBSD and NetBSD"
80                 exit 1
81                 ;;
82 esac
83
84 echo >>$c '#define HAVE_PM_DUMP'
85 echo " dump"
86 if [ -z "$ok" ] ; then
87         echo "WARNING: No real configuration access method is available."
88 fi
89 echo >>$c "#define PATH_PCI_IDS \"$prefix/share/pci.ids\""
90 echo >>$c "#define PCILIB_VERSION \"$version\""
91 sed '/^#define [^ ]*$/!d;s/^#define \(.*\)/\1=1/' <$c >config.mk