]> mj.ucw.cz Git - pciutils.git/blobdiff - lib/configure
pciutils: Decode available DVSEC details
[pciutils.git] / lib / configure
index e00007926b60ff97f8a3842f19f02568056e08fb..08b94624b9425a2f52c252de0c368f997b7dd982 100755 (executable)
@@ -6,12 +6,7 @@ LC_ALL=C
 export LC_ALL
 
 echo_n() {
-       if [ -n "$BASH" ]
-       then
-               echo -n "$*"
-       else
-               echo "$*\c"
-       fi
+       printf '%s' "$*"
 }
 
 if [ -z "$VERSION" -o -z "$IDSDIR" ] ; then
@@ -44,7 +39,7 @@ if [ -z "$HOST" ] ; then
 fi
 [ -n "$RELEASE" ] && rel="${RELEASE}"
 # CAVEAT: tr on Solaris is a bit weird and the extra [] is otherwise harmless.
-host=`echo $HOST | sed -e 's/^\([^-]*\)-\([^-]*\)-\([^-]*\)-\([^-]*\)$/\1-\3/' -e 's/^\([^-]*\)-\([^-]*\)$/\1--\2/' | tr '[A-Z]' '[a-z]'`
+host=`echo $HOST | sed -e 's/^\([^-]*\)-\([^-]*\)-\([^-]*\)-\([^-]*\)$/\1-\3/' -e 's/^\([^-]*\)-\([^-]*\)-\([^-]*\)$/\1-\2/' -e 's/^\([^-]*\)-\([^-]*\)$/\1--\2/' | tr '[A-Z]' '[a-z]'`
 cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo " $host $rel $cpu $sys"
@@ -58,6 +53,7 @@ echo >$m 'WITH_LIBS='
 
 echo_n "Looking for access methods..."
 LIBRESOLV=-lresolv
+LIBEXT=so
 
 case $sys in
        linux*)
@@ -101,12 +97,13 @@ case $sys in
                LIBRESOLV=
                ;;
 
-        darwin)
-               echo_n " darwin-device"
+        darwin*)
+               echo_n " darwin"
                echo >>$c '#define PCI_HAVE_PM_DARWIN_DEVICE'
                echo >>$m 'WITH_LIBS+=-lresolv -framework CoreFoundation -framework IOKit'
                echo >>$c '#define PCI_HAVE_64BIT_ADDRESS'
                LIBRESOLV=
+               LIBEXT=dylib
                ;;
        aix)
                echo_n " aix-device"
@@ -119,11 +116,17 @@ case $sys in
                echo_n " nbsd-libpci"
                echo >>$c '#define PCI_HAVE_PM_NBSD_LIBPCI'
                echo >>$c '#define PCI_PATH_NBSD_DEVICE "/dev/pci0"'
+               echo >>$c '#define PCI_HAVE_64BIT_ADDRESS'
                echo >>$m 'LIBNAME=libpciutils'
                echo >>$m 'WITH_LIBS+=-lpci'
                LIBRESOLV=
                ;;
-       gnu)
+       gnu)
+               echo_n " hurd i386-ports"
+               echo >>$c '#define PCI_HAVE_PM_HURD_CONF'
+               echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
+               ;;
+       djgpp)
                echo_n " i386-ports"
                echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
                ;;
@@ -140,12 +143,20 @@ case $sys in
                esac
                echo >>$c '#define PCI_HAVE_STDINT_H'
                ;;
+       sylixos)
+               echo >>$c '#define PCI_PATH_SYLIXOS_DEVICE "/proc/pci"'
+               echo >>$c '#define PCI_HAVE_64BIT_ADDRESS'
+               echo >>$c '#define PCI_HAVE_PM_SYLIXOS_DEVICE'
+               IDSDIR="/etc/pci"
+               LIBRESOLV=
+               ;;
        *)
                echo " Unfortunately, your OS is not supported by the PCI Library"
                exit 1
                ;;
 esac
 
+echo >>$m "LIBEXT="$LIBEXT
 echo >>$c '#define PCI_HAVE_PM_DUMP'
 echo " dump"
 
@@ -219,6 +230,23 @@ if [ "$sys" = linux ] ; then
                echo >>$m "LIBKMOD_CFLAGS=$($PKG_CONFIG --cflags libkmod)"
                echo >>$m "LIBKMOD_LIBS=$($PKG_CONFIG --libs libkmod)"
        fi
+
+       echo_n "Checking for udev hwdb support... "
+       if [ "$HWDB" = yes -o "$HWDB" = no ] ; then
+               echo "$HWDB (set manually)"
+       else
+               if `which pkg-config >/dev/null && pkg-config --atleast-version=196 libudev` ; then
+                       HWDB=yes
+               else
+                       HWDB=no
+               fi
+               echo "$HWDB (auto-detected)"
+       fi
+       if [ "$HWDB" = yes ] ; then
+               echo >>$c '#define PCI_HAVE_HWDB'
+               echo >>$m 'LIBUDEV=-ludev'
+               echo >>$m 'WITH_LIBS+=$(LIBUDEV)'
+       fi
 fi
 
 echo "Checking whether to build a shared library... $SHARED (set manually)"
@@ -227,13 +255,17 @@ if [ "$SHARED" = no ] ; then
        echo >>$m 'LDLIBS=$(WITH_LIBS)'
        echo >>$m 'LIB_LDLIBS='
 else
-       echo >>$m 'PCILIB=$(LIBNAME).so.$(VERSION)'
+       if [ "$LIBEXT" = so ]; then
+               echo >>$m 'PCILIB=$(LIBNAME).$(LIBEXT).$(VERSION)'
+       else
+               echo >>$m 'PCILIB=$(LIBNAME).$(VERSION).$(LIBEXT)'
+       fi
        # We link the dependencies _to_ the library, so we do not need explicit deps in .pc
        echo >>$m 'LDLIBS='
        echo >>$m 'LIB_LDLIBS=$(WITH_LIBS)'
        echo >>$c '#define PCI_SHARED_LIB'
-       if [ "$SHARED" = yes ; then
-               echo >>$m 'SONAME=-Wl,-soname,$(LIBNAME).so$(ABI_VERSION)'
+       if [ "$SHARED" = yes -a "$LIBEXT" = so ]; then
+               echo >>$m 'SONAME=-Wl,-soname,$(LIBNAME).$(LIBEXT)$(ABI_VERSION)'
        fi
 fi
 echo >>$m 'PCILIBPC=$(LIBNAME).pc'