--- origsrc/perl-5.22.1/Configure.orig
+++ src/perl-5.22.1/Configure
@@ -326,14 +326,15 @@
 sysroot=''
 _a=''
 _exe=''
 _o=''
 archobjs=''
 exe_ext=''
 firstmakefile=''
+libprefix='lib'
 lib_ext=''
 obj_ext=''
 path_sep=''
 rm_try=''
 afs=''
 afsroot=''
 alignbytes=''
@@ -5281,37 +5282,52 @@
 libspath=''
 for thisdir in $libpth $xlibpth; do
   test -d $thisdir && libspath="$libspath $thisdir"
 done
 for thislib in $libswanted; do
 	for thisdir in $libspath; do
 	    xxx=''
-	    if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
-		xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
-	        $test -f "$xxx" && eval $libscheck
-		$test -f "$xxx" && libstyle=shared
-		xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
-	        $test -f "$xxx" && eval $libscheck
-		$test -f "$xxx" && libstyle=shared
-	    fi
-	    if test ! -f "$xxx"; then
-		xxx=$thisdir/lib$thislib.$so
-	        $test -f "$xxx" && eval $libscheck
-		$test -f "$xxx" && libstyle=shared
-	    fi
-	    if test ! -f "$xxx"; then
-		xxx=$thisdir/lib$thislib$_a
-	        $test -f "$xxx" && eval $libscheck
-		$test -f "$xxx" && libstyle=static
-	    fi
-	    if test ! -f "$xxx"; then
-		xxx=$thisdir/$thislib$_a
-	        $test -f "$xxx" && eval $libscheck
-		$test -f "$xxx" && libstyle=static
-	    fi
+           if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
+               xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=shared
+               xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=shared
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/lib$thislib.$so$_a
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle="import"
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/$thislib.$so$_a
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle="import"
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/lib$thislib.$so
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=shared
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/$libprefix$thislib.$so
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle="system"
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/lib$thislib$_a
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=static
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/$thislib$_a
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=static
+           fi
 	    if test ! -f "$xxx"; then
 		xxx=$thisdir/lib${thislib}_s$_a
 	        $test -f "$xxx" && eval $libscheck
 		$test -f "$xxx" && libstyle=static
 		$test -f "$xxx" && thislib=${thislib}_s
 	    fi
 	    if test ! -f "$xxx"; then
