]> mj.ucw.cz Git - pciutils.git/blob - lib/configure
<stdint.h> for Solaris.
[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 idsdir=${1:-/usr/share}
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/;s/^i86pc$/i386/'`
24 fi
25 if [ "$sys" = "GNU/kFreeBSD" ]
26 then
27         sys=freebsd
28 fi
29 host=${3:-$cpu-$sys}
30 host=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)$/\1--\2/' | tr 'A-Z' 'a-z'`
31 cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
32 sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
33 rel=${4:-$rel}
34 echo " $host $rel"
35 zlib=$5
36
37 c=config.h
38 m=config.mk
39 echo >$c "#define PCI_ARCH_`echo $cpu | tr 'a-z' 'A-Z'`"
40 echo >>$c "#define PCI_OS_`echo $sys | tr 'a-z' 'A-Z'`"
41 rm -f $m
42
43 echo_n "Looking for access methods..."
44
45 case $sys in
46         linux*)
47                 echo_n " sysfs proc"
48                 echo >>$c '#define PCI_HAVE_PM_LINUX_SYSFS'
49                 echo >>$c '#define PCI_HAVE_PM_LINUX_PROC'
50                 echo >>$c '#define PCI_HAVE_LINUX_BYTEORDER_H'
51                 echo >>$c '#define PCI_PATH_PROC_BUS_PCI "/proc/bus/pci"'
52                 echo >>$c '#define PCI_PATH_SYS_BUS_PCI "/sys/bus/pci"'
53                 case $cpu in
54                                 i386)           echo_n " i386-ports"
55                                                 echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
56                                                 ;;
57                 esac
58                 echo >>$c '#define PCI_HAVE_64BIT_ADDRESS'
59                 ;;
60         sunos)
61                 case $cpu in
62                                 i386)           echo_n " i386-ports"
63                                                 echo >>$c "#define PCI_HAVE_PM_INTEL_CONF"
64                                                 ;;
65                                 *)
66                                                 echo " The PCI library is does not support Solaris for this architecture: $cpu"
67                                                 exit 1
68                                                 ;;
69                 esac
70                 echo >>$c '#define PCI_HAVE_STDINT_H'
71                 ;;
72         freebsd)
73                 echo_n " fbsd-device"
74                 echo >>$c '#define PCI_HAVE_PM_FBSD_DEVICE'
75                 echo >>$c '#define PCI_PATH_FBSD_DEVICE "/dev/pci"'
76                 ;;
77         openbsd)
78                 echo_n " obsd-device"
79                 echo >>$c '#define PCI_HAVE_PM_OBSD_DEVICE'
80                 echo >>$c '#define PCI_PATH_OBSD_DEVICE "/dev/pci"'
81                 ;;
82         aix)
83                 echo_n " aix-device"
84                 echo >>$c '#define PCI_HAVE_PM_AIX_DEVICE'
85                 echo >>$m 'CFLAGS=-g'
86                 echo >>$m 'INSTALL=installbsd'
87                 echo >>$m 'DIRINSTALL=mkdir -p'
88                 ;;
89         netbsd)
90                 echo_n " nbsd-libpci"
91                 echo >>$c '#define PCI_HAVE_PM_NBSD_LIBPCI'
92                 echo >>$c '#define PCI_PATH_NBSD_DEVICE "/dev/pci0"'
93                 echo >>$m 'PCILIB=lib/libpciutils.a'
94                 echo >>$m 'LDFLAGS+=-lpci'
95                 ;;
96         gnu)
97                 echo_n " i386-ports"
98                 echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
99                 ;;
100         *)
101                 echo " Unfortunately, your OS is not supported by the PCI Library"
102                 exit 1
103                 ;;
104 esac
105
106 echo >>$c '#define PCI_HAVE_PM_DUMP'
107 echo " dump"
108
109 echo_n "Checking for zlib support... "
110 if [ "$zlib" = yes -o "$zlib" = no ] ; then
111         echo "$zlib (set manually)"
112 else
113         if [ -f /usr/include/zlib.h ] ; then
114                 zlib=yes
115         else
116                 zlib=no
117         fi
118         echo "$zlib (auto-detected)"
119 fi
120 if [ "$zlib" = yes ] ; then
121         echo >>$c '#define PCI_COMPRESSED_IDS'
122         echo >>$c '#define PCI_IDS "pci.ids.gz"'
123         echo >>$m 'LDFLAGS+=-lz'
124 else
125         echo >>$c '#define PCI_IDS "pci.ids"'
126 fi
127 echo >>$c "#define PCI_PATH_IDS_DIR \"$idsdir\""
128
129 echo >>$c "#define PCILIB_VERSION \"$version\""
130 sed '/"/{s/^#define \([^ ]*\) "\(.*\)"$/\1=\2/;p;d;};s/^#define \(.*\)/\1=1/' <$c >>$m