From d27994fd0542d6f1f7dd0acfa04b75c29a99b8a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Jun 2015 19:45:44 +0200
Subject: nvcuda: Search for dylib library on Mac OS X.

---
 dlls/nvcuda/nvcuda.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/dlls/nvcuda/nvcuda.c b/dlls/nvcuda/nvcuda.c
index ec32da2..67376c7 100644
--- a/dlls/nvcuda/nvcuda.c
+++ b/dlls/nvcuda/nvcuda.c
@@ -412,11 +412,28 @@ static void *cuda_handle = NULL;
 
 static BOOL load_functions(void)
 {
-    cuda_handle = wine_dlopen("libcuda.so", RTLD_NOW, NULL, 0);
+    static const char *libname[] =
+    {
+    #ifdef __APPLE__
+        "libcuda.dylib",
+        "libcuda.6.0.dylib",
+        "/usr/local/cuda/lib/libcuda.dylib",
+        "/usr/local/cuda/lib/libcuda.6.0.dylib",
+    #else
+        "libcuda.so"
+    #endif
+    };
+    int i;
+
+    for (i = 0; i < sizeof(libname)/sizeof(libname[0]); i++)
+    {
+        cuda_handle = wine_dlopen(libname[i], RTLD_NOW, NULL, 0);
+        if (cuda_handle) break;
+    }
 
     if (!cuda_handle)
     {
-        FIXME("Wine cannot find the libcuda.so library, CUDA support disabled.\n");
+        FIXME("Wine cannot find the libcuda library, CUDA support is disabled.\n");
         return FALSE;
     }
 
-- 
2.4.3

