2 # Configuration script for the PCI library
3 # (c) 1998--2008 Martin Mares <mj@ucw.cz>
14 if [ -z "$VERSION" -o -z "$IDSDIR" ] ; then
15 echo >&2 "Please run the configure script from the top-level Makefile"
19 echo_n "Configuring libpci for your system..."
20 if [ -z "$HOST" ] ; then
23 if [ "$sys" = "AIX" -a -x /usr/bin/oslevel -a -x /usr/sbin/lsattr ]
25 rel=`/usr/bin/oslevel`
26 proc=`/usr/sbin/lsdev -C -c processor -S available -F name | head -1`
27 cpu=`/usr/sbin/lsattr -F value -l $proc -a type | sed 's/_.*//'`
29 cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/'`
31 if [ "$sys" = "GNU/kFreeBSD" -o "$sys" = "DragonFly" ]
37 # CAVEAT: tr on Solaris is a bit weird and the extra [] is otherwise harmless.
38 host=`echo $HOST | sed 's/^\([^-]*\)-\([^-]*\)$/\1--\2/' | tr '[A-Z]' '[a-z]'`
39 cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
40 sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
45 echo >$c "#define PCI_ARCH_`echo $cpu | tr '[a-z]' '[A-Z]'`"
46 echo >>$c "#define PCI_OS_`echo $sys | tr '[a-z]' '[A-Z]'`"
49 echo_n "Looking for access methods..."
54 echo >>$c '#define PCI_HAVE_PM_LINUX_SYSFS'
55 echo >>$c '#define PCI_HAVE_PM_LINUX_PROC'
56 echo >>$c '#define PCI_HAVE_LINUX_BYTEORDER_H'
57 echo >>$c '#define PCI_PATH_PROC_BUS_PCI "/proc/bus/pci"'
58 echo >>$c '#define PCI_PATH_SYS_BUS_PCI "/sys/bus/pci"'
60 i386|x86_64) echo_n " i386-ports"
61 echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
64 echo >>$c '#define PCI_HAVE_64BIT_ADDRESS'
65 echo >>$c '#define PCI_USE_DNS'
69 i386) echo_n " i386-ports"
70 echo >>$c "#define PCI_HAVE_PM_INTEL_CONF"
73 echo " The PCI library does not support Solaris for this architecture: $cpu"
77 echo >>$c '#define PCI_HAVE_STDINT_H'
81 echo >>$c '#define PCI_HAVE_PM_FBSD_DEVICE'
82 echo >>$c '#define PCI_PATH_FBSD_DEVICE "/dev/pci"'
86 echo >>$c '#define PCI_HAVE_PM_OBSD_DEVICE'
87 echo >>$c '#define PCI_PATH_OBSD_DEVICE "/dev/pci"'
91 echo >>$c '#define PCI_HAVE_PM_AIX_DEVICE'
93 echo >>$m 'INSTALL=installbsd'
94 echo >>$m 'DIRINSTALL=mkdir -p'
98 echo >>$c '#define PCI_HAVE_PM_NBSD_LIBPCI'
99 echo >>$c '#define PCI_PATH_NBSD_DEVICE "/dev/pci0"'
100 echo >>$m 'PCILIB=lib/libpciutils.a'
101 echo >>$m 'LDLIBS+=-lpci'
105 echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
108 echo " Unfortunately, your OS is not supported by the PCI Library"
113 echo >>$c '#define PCI_HAVE_PM_DUMP'
116 echo_n "Checking for zlib support... "
117 if [ "$ZLIB" = yes -o "$ZLIB" = no ] ; then
118 echo "$ZLIB (set manually)"
120 if [ -f /usr/include/zlib.h -o -f /usr/local/include/zlib.h ] ; then
125 echo "$ZLIB (auto-detected)"
127 if [ "$ZLIB" = yes ] ; then
128 echo >>$c '#define PCI_COMPRESSED_IDS'
129 echo >>$c '#define PCI_IDS "pci.ids.gz"'
131 echo >>$m 'LDLIBS+=$(LIBZ)'
133 echo >>$c '#define PCI_IDS "pci.ids"'
135 echo >>$c "#define PCI_PATH_IDS_DIR \"$IDSDIR\""
137 echo_n "Checking for DNS support... "
138 if [ "$DNS" = yes -o "$DNS" = no ] ; then
139 echo "$DNS (set manually)"
141 if [ -f /usr/include/resolv.h ] ; then
146 echo "$DNS (auto-detected)"
148 if [ "$DNS" = yes ] ; then
149 echo >>$c "#define PCI_USE_DNS"
150 echo >>$c "#define PCI_ID_DOMAIN \"pci-id.ucw.cz\""
151 echo >>$m 'LDLIBS+=-lresolv'
154 echo >>$c "#define PCILIB_VERSION \"$VERSION\""
155 sed '/"/{s/^#define \([^ ]*\) "\(.*\)"$/\1=\2/;p;d;};s/^#define \(.*\)/\1=1/' <$c >>$m