Annotation of embedaddon/pciutils/lib/configure, revision 1.1
1.1 ! misho 1: #!/bin/sh
! 2: # Configuration script for the PCI library
! 3: # (c) 1998--2009 Martin Mares <mj@ucw.cz>
! 4:
! 5: LC_ALL=C
! 6: export LC_ALL
! 7:
! 8: echo_n() {
! 9: if [ -n "$BASH" ]
! 10: then
! 11: echo -n "$*"
! 12: else
! 13: echo "$*\c"
! 14: fi
! 15: }
! 16:
! 17: if [ -z "$VERSION" -o -z "$IDSDIR" ] ; then
! 18: echo >&2 "Please run the configure script from the top-level Makefile"
! 19: exit 1
! 20: fi
! 21:
! 22: echo_n "Configuring libpci for your system..."
! 23: if [ -z "$HOST" ] ; then
! 24: sys=`uname -s`
! 25: rel=`uname -r`
! 26: realsys="$sys"
! 27: if [ "$sys" = "AIX" -a -x /usr/bin/oslevel -a -x /usr/sbin/lsattr ]
! 28: then
! 29: rel=`/usr/bin/oslevel`
! 30: proc=`/usr/sbin/lsdev -C -c processor -S available -F name | head -1`
! 31: cpu=`/usr/sbin/lsattr -F value -l $proc -a type | sed 's/_.*//'`
! 32: else
! 33: cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/;s/^BePC$/i386/;s/^BeMac$/powerpc/;s/^BeBox$/powerpc/'`
! 34: fi
! 35: if [ "$sys" = "GNU/kFreeBSD" -o "$sys" = "DragonFly" ]
! 36: then
! 37: sys=freebsd
! 38: fi
! 39: if [ "$sys" = "CYGWIN_NT-5.1" -o "$sys" = "CYGWIN_NT-6.0" ]
! 40: then
! 41: sys=cygwin
! 42: fi
! 43: HOST=${3:-$cpu-$sys}
! 44: fi
! 45: [ -n "$RELEASE" ] && rel="${RELEASE}"
! 46: # CAVEAT: tr on Solaris is a bit weird and the extra [] is otherwise harmless.
! 47: host=`echo $HOST | sed -e 's/^\([^-]*\)-\([^-]*\)-\([^-]*\)-\([^-]*\)$/\1-\3/' -e 's/^\([^-]*\)-\([^-]*\)$/\1--\2/' | tr '[A-Z]' '[a-z]'`
! 48: cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
! 49: sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
! 50: echo " $host $rel $cpu $sys"
! 51:
! 52: c=config.h
! 53: m=config.mk
! 54: echo >$c '#define PCI_CONFIG_H'
! 55: echo >>$c "#define PCI_ARCH_`echo $cpu | tr '[a-z]' '[A-Z]'`"
! 56: echo >>$c "#define PCI_OS_`echo $sys | tr '[a-z]' '[A-Z]'`"
! 57: echo >$m 'WITH_LIBS='
! 58:
! 59: echo_n "Looking for access methods..."
! 60: LIBRESOLV=-lresolv
! 61:
! 62: case $sys in
! 63: linux*)
! 64: echo_n " sysfs proc"
! 65: echo >>$c '#define PCI_HAVE_PM_LINUX_SYSFS'
! 66: echo >>$c '#define PCI_HAVE_PM_LINUX_PROC'
! 67: echo >>$c '#define PCI_HAVE_LINUX_BYTEORDER_H'
! 68: echo >>$c '#define PCI_PATH_PROC_BUS_PCI "/proc/bus/pci"'
! 69: echo >>$c '#define PCI_PATH_SYS_BUS_PCI "/sys/bus/pci"'
! 70: case $cpu in
! 71: i?86|x86_64) echo_n " i386-ports"
! 72: echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
! 73: ;;
! 74: esac
! 75: echo >>$c '#define PCI_HAVE_64BIT_ADDRESS'
! 76: ;;
! 77: sunos)
! 78: case $cpu in
! 79: i?86) echo_n " i386-ports"
! 80: echo >>$c "#define PCI_HAVE_PM_INTEL_CONF"
! 81: ;;
! 82: *)
! 83: echo " The PCI library does not support Solaris for this architecture: $cpu"
! 84: exit 1
! 85: ;;
! 86: esac
! 87: echo >>$c '#define PCI_HAVE_STDINT_H'
! 88: ;;
! 89: freebsd)
! 90: echo_n " fbsd-device"
! 91: echo >>$c '#define PCI_HAVE_PM_FBSD_DEVICE'
! 92: echo >>$c '#define PCI_PATH_FBSD_DEVICE "/dev/pci"'
! 93: if [ "$realsys" != "GNU/kFreeBSD" ] ; then
! 94: LIBRESOLV=
! 95: fi
! 96: ;;
! 97: openbsd)
! 98: echo_n " obsd-device"
! 99: echo >>$c '#define PCI_HAVE_PM_OBSD_DEVICE'
! 100: echo >>$c '#define PCI_PATH_OBSD_DEVICE "/dev/pci"'
! 101: LIBRESOLV=
! 102: ;;
! 103: aix)
! 104: echo_n " aix-device"
! 105: echo >>$c '#define PCI_HAVE_PM_AIX_DEVICE'
! 106: echo >>$m 'CFLAGS=-g'
! 107: echo >>$m 'INSTALL=installbsd'
! 108: echo >>$m 'DIRINSTALL=mkdir -p'
! 109: ;;
! 110: netbsd)
! 111: echo_n " nbsd-libpci"
! 112: echo >>$c '#define PCI_HAVE_PM_NBSD_LIBPCI'
! 113: echo >>$c '#define PCI_PATH_NBSD_DEVICE "/dev/pci0"'
! 114: echo >>$m 'LIBNAME=libpciutils'
! 115: echo >>$m 'WITH_LIBS+=-lpci'
! 116: LIBRESOLV=
! 117: ;;
! 118: gnu)
! 119: echo_n " i386-ports"
! 120: echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
! 121: ;;
! 122: cygwin)
! 123: echo_n " i386-ports"
! 124: echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
! 125: echo >>$m 'WITH_LIBS+=-lioperm'
! 126: ;;
! 127: beos|haiku)
! 128: case $cpu in
! 129: i?86|x86_64) echo_n " i386-ports"
! 130: echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
! 131: ;;
! 132: esac
! 133: echo >>$c '#define PCI_HAVE_STDINT_H'
! 134: ;;
! 135: *)
! 136: echo " Unfortunately, your OS is not supported by the PCI Library"
! 137: exit 1
! 138: ;;
! 139: esac
! 140:
! 141: echo >>$c '#define PCI_HAVE_PM_DUMP'
! 142: echo " dump"
! 143:
! 144: echo_n "Checking for zlib support... "
! 145: if [ "$ZLIB" = yes -o "$ZLIB" = no ] ; then
! 146: echo "$ZLIB (set manually)"
! 147: else
! 148: if [ -f /usr/include/zlib.h -o -f /usr/local/include/zlib.h ] ; then
! 149: ZLIB=yes
! 150: else
! 151: ZLIB=no
! 152: fi
! 153: echo "$ZLIB (auto-detected)"
! 154: fi
! 155: if [ "$ZLIB" = yes ] ; then
! 156: echo >>$c '#define PCI_COMPRESSED_IDS'
! 157: echo >>$c '#define PCI_IDS "pci.ids.gz"'
! 158: echo >>$m 'LIBZ=-lz'
! 159: echo >>$m 'WITH_LIBS+=$(LIBZ)'
! 160: else
! 161: echo >>$c '#define PCI_IDS "pci.ids"'
! 162: fi
! 163: echo >>$c "#define PCI_PATH_IDS_DIR \"$IDSDIR\""
! 164:
! 165: echo_n "Checking for DNS support... "
! 166: if [ "$DNS" = yes -o "$DNS" = no ] ; then
! 167: echo "$DNS (set manually)"
! 168: else
! 169: if [ -f /usr/include/resolv.h ] ; then
! 170: DNS=yes
! 171: else
! 172: DNS=no
! 173: fi
! 174: echo "$DNS (auto-detected)"
! 175: fi
! 176: if [ "$DNS" = yes ] ; then
! 177: echo >>$c "#define PCI_USE_DNS"
! 178: echo >>$c "#define PCI_ID_DOMAIN \"pci.id.ucw.cz\""
! 179: echo >>$m "WITH_LIBS+=$LIBRESOLV"
! 180: fi
! 181:
! 182: echo "Checking whether to build a shared library... $SHARED (set manually)"
! 183: if [ "$SHARED" = no ] ; then
! 184: echo >>$m 'PCILIB=$(LIBNAME).a'
! 185: echo >>$m 'LDLIBS=$(WITH_LIBS)'
! 186: echo >>$m 'LIB_LDLIBS='
! 187: else
! 188: echo >>$m 'PCILIB=$(LIBNAME).so.$(VERSION)'
! 189: # We link the dependencies _to_ the library, so we do not need explicit deps in .pc
! 190: echo >>$m 'LDLIBS='
! 191: echo >>$m 'LIB_LDLIBS=$(WITH_LIBS)'
! 192: echo >>$c '#define PCI_SHARED_LIB'
! 193: if [ "$SHARED" = yes ] ; then
! 194: echo >>$m 'SONAME=-Wl,-soname,$(LIBNAME).so$(ABI_VERSION)'
! 195: fi
! 196: fi
! 197: echo >>$m 'PCILIBPC=$(LIBNAME).pc'
! 198:
! 199: echo >>$c "#define PCILIB_VERSION \"$VERSION\""
! 200: sed '/"/{s/^#define \([^ ]*\) "\(.*\)"$/\1=\2/;p;d;};s/^#define \(.*\)/\1=1/' <$c >>$m
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>