Make dynamic linking smarter, so this stuff works before running 'make install'
authorAdam Chlipala <adamc@hcoop.net>
Sun, 27 Sep 2009 17:02:49 +0000 (17:02 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Sun, 27 Sep 2009 17:02:49 +0000 (17:02 +0000)
openssl/mlton/libssl-h.sml
openssl/smlnj/libssl-h.sml
pcre/mlton/libpcre-h.sml
pcre/smlnj/libpcre-h.sml

index 7bf5f0b..891158b 100644 (file)
@@ -1,7 +1,10 @@
 structure LibsslH = struct
     local
 structure LibsslH = struct
     local
+       val global = "/usr/local/lib/openssl_sml.so"
+       val locl = "openssl/openssl_sml.so"
+
         val lh = DynLinkage.open_lib
         val lh = DynLinkage.open_lib
-             { name = "/usr/local/lib/openssl_sml.so", global = true, lazy = true }
+             { name = if Posix.FileSys.access (global, []) then global else locl, global = true, lazy = true }
            handle DynLinkage.DynLinkError s => raise Fail s
     in
         fun libh s = let
            handle DynLinkage.DynLinkError s => raise Fail s
     in
         fun libh s = let
index 7bf5f0b..891158b 100644 (file)
@@ -1,7 +1,10 @@
 structure LibsslH = struct
     local
 structure LibsslH = struct
     local
+       val global = "/usr/local/lib/openssl_sml.so"
+       val locl = "openssl/openssl_sml.so"
+
         val lh = DynLinkage.open_lib
         val lh = DynLinkage.open_lib
-             { name = "/usr/local/lib/openssl_sml.so", global = true, lazy = true }
+             { name = if Posix.FileSys.access (global, []) then global else locl, global = true, lazy = true }
            handle DynLinkage.DynLinkError s => raise Fail s
     in
         fun libh s = let
            handle DynLinkage.DynLinkError s => raise Fail s
     in
         fun libh s = let
index 356df39..3412cf6 100644 (file)
@@ -1,7 +1,10 @@
 structure LibpcreH = struct
     local
 structure LibpcreH = struct
     local
+       val global = "/usr/local/lib/pcre_sml.so"
+       val locl = "openssl/pcre_sml.so"
+
         val lh = DynLinkage.open_lib
         val lh = DynLinkage.open_lib
-             { name = "/usr/local/lib/pcre_sml.so", global = true, lazy = true }
+             { name = if Posix.FileSys.access (global, []) then global else locl, global = true, lazy = true }
            handle DynLinkage.DynLinkError s => raise Fail s
     in
         fun libh s = let
            handle DynLinkage.DynLinkError s => raise Fail s
     in
         fun libh s = let
index 356df39..3412cf6 100644 (file)
@@ -1,7 +1,10 @@
 structure LibpcreH = struct
     local
 structure LibpcreH = struct
     local
+       val global = "/usr/local/lib/pcre_sml.so"
+       val locl = "openssl/pcre_sml.so"
+
         val lh = DynLinkage.open_lib
         val lh = DynLinkage.open_lib
-             { name = "/usr/local/lib/pcre_sml.so", global = true, lazy = true }
+             { name = if Posix.FileSys.access (global, []) then global else locl, global = true, lazy = true }
            handle DynLinkage.DynLinkError s => raise Fail s
     in
         fun libh s = let
            handle DynLinkage.DynLinkError s => raise Fail s
     in
         fun libh s = let