]> mj.ucw.cz Git - pciutils.git/blobdiff - lib/configure
libresolv is not available on BSD systems, but they have resolver in libc.
[pciutils.git] / lib / configure
index 20720230189bfa2398aec8090fe4a9e87e175f17..bec5f864a06809870d1a10ae5a597dc65af2d18d 100755 (executable)
@@ -44,9 +44,10 @@ c=config.h
 m=config.mk
 echo >$c "#define PCI_ARCH_`echo $cpu | tr '[a-z]' '[A-Z]'`"
 echo >>$c "#define PCI_OS_`echo $sys | tr '[a-z]' '[A-Z]'`"
-echo >$m 'LDLIBS='
+echo >$m 'WITH_LIBS='
 
 echo_n "Looking for access methods..."
+LIBRESOLV=-lresolv
 
 case $sys in
        linux*)
@@ -62,7 +63,6 @@ case $sys in
                                                ;;
                esac
                echo >>$c '#define PCI_HAVE_64BIT_ADDRESS'
-               echo >>$c '#define PCI_USE_DNS'
                ;;
        sunos)
                case $cpu in
@@ -80,11 +80,13 @@ case $sys in
                echo_n " fbsd-device"
                echo >>$c '#define PCI_HAVE_PM_FBSD_DEVICE'
                echo >>$c '#define PCI_PATH_FBSD_DEVICE "/dev/pci"'
+               LIBRESOLV=
                ;;
         openbsd)
                echo_n " obsd-device"
                echo >>$c '#define PCI_HAVE_PM_OBSD_DEVICE'
                echo >>$c '#define PCI_PATH_OBSD_DEVICE "/dev/pci"'
+               LIBRESOLV=
                ;;
        aix)
                echo_n " aix-device"
@@ -97,8 +99,9 @@ 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 >>$m 'PCILIB=lib/libpciutils.a'
-               echo >>$m 'LDLIBS+=-lpci'
+               echo >>$m 'LIBNAME=libpciutils'
+               echo >>$m 'WITH_LIBS+=-lpci'
+               LIBRESOLV=
                ;;
        gnu)
                echo_n " i386-ports"
@@ -128,7 +131,7 @@ if [ "$ZLIB" = yes ] ; then
        echo >>$c '#define PCI_COMPRESSED_IDS'
        echo >>$c '#define PCI_IDS "pci.ids.gz"'
        echo >>$m 'LIBZ=-lz'
-       echo >>$m 'LDLIBS+=$(LIBZ)'
+       echo >>$m 'WITH_LIBS+=$(LIBZ)'
 else
        echo >>$c '#define PCI_IDS "pci.ids"'
 fi
@@ -147,9 +150,25 @@ else
 fi
 if [ "$DNS" = yes ] ; then
        echo >>$c "#define PCI_USE_DNS"
-       echo >>$c "#define PCI_ID_DOMAIN \"pci-id.ucw.cz\""
-       echo >>$m 'LDLIBS+=-lresolv'
+       echo >>$c "#define PCI_ID_DOMAIN \"pci.id.ucw.cz\""
+       echo >>$m "WITH_LIBS+=$LIBRESOLV"
 fi
 
+echo "Checking whether to build a shared library... $SHARED (set manually)"
+if [ "$SHARED" = no ] ; then
+       echo >>$m 'PCILIB=$(LIBNAME).a'
+       echo >>$m 'LDLIBS=$(WITH_LIBS)'
+       echo >>$m 'LIB_LDLIBS='
+else
+       echo >>$m 'PCILIB=$(LIBNAME).so.$(VERSION)'
+       # 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)'
+       if [ "$SHARED" = yes ] ; then
+               echo >>$m 'SONAME=-Wl,-soname,$(LIBNAME).so$(ABI_VERSION)'
+       fi
+fi
+echo >>$m 'PCILIBPC=$(LIBNAME).pc'
+
 echo >>$c "#define PCILIB_VERSION \"$VERSION\""
 sed '/"/{s/^#define \([^ ]*\) "\(.*\)"$/\1=\2/;p;d;};s/^#define \(.*\)/\1=1/' <$c >>$m