Allow to append a suffix to the library name via configuration
variable SONAME_SUFFIX.

--- a/configure.ac
+++ b/configure.ac
@@ -74,6 +74,8 @@
       [],[enable_symvers=yes])
 AM_CONDITIONAL(SYMVERS, test "x$enable_symvers" = xyes)
 
+AC_ARG_VAR([SONAME_SUFFIX], [Suffix to be appended to the library name])
+
 AC_CANONICAL_BUILD
 # Check for which host we are on and setup a few things
 # specifically based on the host
@@ -98,6 +100,7 @@
 AC_CHECK_FUNCS([getrpcbyname getrpcbynumber setrpcent endrpcent getrpcent])
 
 AC_CONFIG_FILES([Makefile src/Makefile man/Makefile doc/Makefile])
-AC_OUTPUT(libtirpc.pc)
+AC_CONFIG_FILES([libtirpc$SONAME_SUFFIX.pc:libtirpc.pc.in])
+AC_OUTPUT
 
 
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,7 +46,7 @@
 endif
 
 pkgconfigdir=$(libdir)/pkgconfig
-pkgconfig_DATA = libtirpc.pc
+pkgconfig_DATA = libtirpc@SONAME_SUFFIX@.pc
 
 CLEANFILES	       = cscope.* *~
 DISTCLEANFILES	       = Makefile.in libtirpc*.tar.gz
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,12 +10,12 @@
 AM_CPPFLAGS = -I$(top_srcdir)/tirpc -include config.h -DPORTMAP -DINET6 \
 		-D_GNU_SOURCE -Wall -pipe
 
-lib_LTLIBRARIES = libtirpc.la
+lib_LTLIBRARIES = libtirpc@SONAME_SUFFIX@.la
 
-libtirpc_la_LDFLAGS = @LDFLAG_NOUNDEFINED@ -no-undefined -lpthread
-libtirpc_la_LDFLAGS += -version-info @LT_VERSION_INFO@
+libtirpc@SONAME_SUFFIX@_la_LDFLAGS = @LDFLAG_NOUNDEFINED@ -no-undefined -lpthread
+libtirpc@SONAME_SUFFIX@_la_LDFLAGS += -version-info @LT_VERSION_INFO@
 
-libtirpc_la_SOURCES = auth_none.c auth_unix.c authunix_prot.c \
+libtirpc@SONAME_SUFFIX@_la_SOURCES = auth_none.c auth_unix.c authunix_prot.c \
         binddynport.c bindresvport.c \
         clnt_bcast.c clnt_dg.c clnt_generic.c clnt_perror.c clnt_raw.c clnt_simple.c \
         clnt_vc.c rpc_dtablesize.c getnetconfig.c getnetpath.c getrpcent.c \
@@ -27,26 +27,26 @@
         auth_time.c debug.c 
 
 if AUTHDES
-libtirpc_la_SOURCES += auth_des.c  authdes_prot.c  des_crypt.c  des_impl.c  des_soft.c  svc_auth_des.c
+libtirpc@SONAME_SUFFIX@_la_SOURCES += auth_des.c  authdes_prot.c  des_crypt.c  des_impl.c  des_soft.c  svc_auth_des.c
 endif
 
 ## XDR
-libtirpc_la_SOURCES += xdr.c xdr_rec.c xdr_array.c xdr_float.c xdr_mem.c xdr_reference.c xdr_stdio.c xdr_sizeof.c
+libtirpc@SONAME_SUFFIX@_la_SOURCES += xdr.c xdr_rec.c xdr_array.c xdr_float.c xdr_mem.c xdr_reference.c xdr_stdio.c xdr_sizeof.c
 
 if SYMVERS
-    libtirpc_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libtirpc.map
+    libtirpc@SONAME_SUFFIX@_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libtirpc.map
 endif
 
 ## Secure-RPC
 if GSS
-    libtirpc_la_SOURCES += auth_gss.c authgss_prot.c svc_auth_gss.c \
+    libtirpc@SONAME_SUFFIX@_la_SOURCES += auth_gss.c authgss_prot.c svc_auth_gss.c \
 			   rpc_gss_utils.c
-    libtirpc_la_LIBADD = $(GSSAPI_LIBS)
-    libtirpc_la_CFLAGS = -DHAVE_RPCSEC_GSS $(GSSAPI_CFLAGS)
+    libtirpc@SONAME_SUFFIX@_la_LIBADD = $(GSSAPI_LIBS)
+    libtirpc@SONAME_SUFFIX@_la_CFLAGS = -DHAVE_RPCSEC_GSS $(GSSAPI_CFLAGS)
 endif
 
-libtirpc_la_SOURCES += key_call.c key_prot_xdr.c getpublickey.c
-libtirpc_la_SOURCES += netname.c netnamer.c rpcdname.c rtime.c
+libtirpc@SONAME_SUFFIX@_la_SOURCES += key_call.c key_prot_xdr.c getpublickey.c
+libtirpc@SONAME_SUFFIX@_la_SOURCES += netname.c netnamer.c rpcdname.c rtime.c
 
 CLEANFILES	       = cscope.* *~
 DISTCLEANFILES	       = Makefile.in
--- a/libtirpc.pc.in
+++ b/libtirpc.pc.in
@@ -3,10 +3,10 @@
 libdir=@libdir@
 includedir=@includedir@
 
-Name: libtirpc
+Name: libtirpc@SONAME_SUFFIX@
 Description: Transport Independent RPC Library
 Requires:
 Version: @PACKAGE_VERSION@
-Libs: -L@libdir@ -ltirpc
+Libs: -L@libdir@ -ltirpc@SONAME_SUFFIX@
 Libs.private: -lpthread
 Cflags: -I@includedir@/tirpc
