--- cups-1.2rc3/config-scripts/cups-sharedlibs.m4.rpath	2006-04-28 14:17:09.000000000 +0100
+++ cups-1.2rc3/config-scripts/cups-sharedlibs.m4	2006-04-28 14:24:52.000000000 +0100
@@ -26,6 +26,7 @@
 DSOFLAGS="${DSOFLAGS:=}"
 
 AC_ARG_ENABLE(shared, [  --enable-shared         turn on shared libraries, default=yes])
+AC_ARG_ENABLE(rpath, [  --enable-rpath          turn on rpath-style link options, default=yes])
 
 if test x$enable_shared != xno; then
 	case "$uname" in
@@ -45,7 +46,11 @@
 			LIBCUPS="libcups.so.2"
 			LIBCUPSIMAGE="libcupsimage.so.2"
 			DSO="\$(CC)"
-			DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi2.6,-soname,\$@ -shared \$(OPTIM)"
+			RPATH=""
+			if test x$enable_rpath != xno; then
+			  RPATH=",-rpath,\$(libdir)"
+			fi
+			DSOFLAGS="$DSOFLAGS -Wl$RPATH,-set_version,sgi2.6,-soname,\$@ -shared \$(OPTIM)"
 			;;
 		OSF1* | Linux | GNU | *BSD*)
 			LIBCUPS="libcups.so.2"
@@ -63,7 +68,11 @@
 			LIBCUPS="libcups_s.a"
 			LIBCUPSIMAGE="libcupsimage_s.a"
 			DSO="\$(CC)"
-			DSOFLAGS="$DSOFLAGS -Wl,-bexpall,-bM:SRE,-bnoentry,-blibpath:\$(libdir)"
+			RPATH=""
+			if test x$enable_rpath != xno; then
+			  RPATH=",-blibpath:\$(libdir)"
+			fi
+			DSOFLAGS="$DSOFLAGS -Wl,-bexpall,-bM:SRE,-bnoentry$RPATH"
 			;;
 		*)
 			echo "Warning: shared libraries may not be supported.  Trying -shared"
@@ -116,7 +125,7 @@
 	# The *BSD, HP-UX, and Solaris run-time linkers need help when
 	# deciding where to find a DSO.  Add linker options to tell them
 	# where to find the DSO (usually in /usr/lib...  duh!)
-	case $uname in
+	if test x$enable_rpath != xno; then case $uname in
                 HP-UX*)
 			# HP-UX
                 	DSOFLAGS="+s +b $libdir $DSOFLAGS"
@@ -141,7 +150,7 @@
                         LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
                         EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
                         ;;
-	esac
+	esac; fi
 else
 	DSOLIBS=""
 	IMGLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
