Index: t/library/pcre.t
===================================================================
--- t/library/pcre.t	(revision 23313)
+++ t/library/pcre.t	(working copy)
@@ -26,16 +26,41 @@
 # if we keep pcre, we need a config test
 my $cmd = ( $^O =~ /MSWin32/ ) ? "pcregrep --version" : "pcre-config --version";
 my $has_pcre = !Parrot::Test::run_command( $cmd, STDERR => File::Spec->devnull, );
+my $pcre_libpath = "";
 
+# It's possible that libpcre is installed in some non-standard path...
+if ($has_pcre && ($^O !~ /MSWin32/)) {
+    # Extract the library path for non-windows platforms (in case it isn't in
+    # the normal lookup locations)
+    my $outfile = "pcre-config.out";
+    Parrot::Test::run_command("pcre-config --prefix", STDOUT => $outfile);
+    my $out = Parrot::Test::slurp_file($outfile);
+    unlink $outfile;
+    chomp $out;
+    $pcre_libpath="$out/lib";
+}
+
 SKIP: {
     skip( "no pcre-config", Test::Builder->new()->expected_tests() )
         unless $has_pcre;
 
 ## 1
-    pir_output_is( <<'CODE', <<'OUT', 'soup to nuts' );
+    pir_output_is( <<"CODE", <<'OUT', 'soup to nuts' );
 
+.include 'iglobals.pasm'
 
 .sub main :main
+    .local pmc interp
+    getinterp interp
+
+    .local pmc lib_paths
+    lib_paths = interp[.IGLOBALS_LIB_PATHS]
+
+    # XXX - hard-coded magic constant (should be PARROT_LIB_PATH_DYNEXT)
+    .local pmc include_paths
+    include_paths = lib_paths[2]
+    unshift include_paths, '$pcre_libpath'
+
     load_bytecode "library/pcre.pir"
     .local pmc func
     .local pmc lib
@@ -47,7 +72,7 @@
 NOK1:
     print 'not '
 OK1:
-    print "ok 1\n"
+    print "ok 1\\n"
 
     lib= func()
     if_null lib, NOK2
@@ -55,7 +80,7 @@
 NOK2:
     print 'not '
 OK2:
-    print "ok 2\n"
+    print "ok 2\\n"
 
 
     .local string s
@@ -76,7 +101,7 @@
     if is_code_defined goto OK3
     print 'not '
 OK3:
-    print "ok 3\n"
+    print "ok 3\\n"
 
     .local int ok
     .local pmc result
@@ -87,7 +112,7 @@
     unless ok < 0 goto OK4
     print 'not '
 OK4:
-    print "ok 4\n"
+    print "ok 4\\n"
 
     .local int i
     i= 0
@@ -98,7 +123,7 @@
     if 'a' == match goto OK5
     print 'not '
 OK5:
-    print "ok 5\n"
+    print "ok 5\\n"
 
 .end
 CODE
