aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/proxy-libintl/proxy-libintl-20080418/stub-only.patch
blob: 7186b13c0669cbbcd58db436bec669fad2f90efd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Index: proxy-libintl/src/proxy-libintl/libintl.c
===================================================================
--- proxy-libintl.orig/src/proxy-libintl/libintl.c
+++ proxy-libintl/src/proxy-libintl/libintl.c
@@ -18,9 +18,12 @@
  */
 
 #ifdef _WIN32
-#include <windows.h>
+#  include <windows.h>
 #else
-#include <dlfcn.h>
+#  include <stddef.h>
+#  if !STUB_ONLY
+#    include <dlfcn.h>
+#  endif
 typedef void* HMODULE;
 #endif
 
@@ -65,11 +68,13 @@ static char * (*p_bind_textdomain_codese
 static int
 use_intl_dll (HMODULE dll)
 {
-#ifdef _WIN32
-#define LOOKUP(fn) p_##fn = (void *) GetProcAddress (dll, #fn); if (p_##fn == NULL) return 0
-#else
-#define LOOKUP(fn) p_##fn = (void *) dlsym (dll, #fn); if (p_##fn == NULL) return 0
-#endif
+#if !STUB_ONLY
+#  ifdef _WIN32
+#    define LOOKUP(fn) p_##fn = (void *) GetProcAddress (dll, #fn); if (p_##fn == NULL) return 0
+#  else
+#    define LOOKUP(fn) p_##fn = (void *) dlsym (dll, #fn); if (p_##fn == NULL) return 0
+#  endif  /* _WIN32 */
+
 
   LOOKUP (gettext);
   LOOKUP (dgettext);
@@ -82,7 +87,7 @@ use_intl_dll (HMODULE dll)
   LOOKUP (bind_textdomain_codeset);
   
 #undef LOOKUP
-
+#endif  /* !STUB_ONLY */
   return 1;
 }
 
@@ -171,13 +176,17 @@ setup (void)
 
   if (!beenhere)
     {
-#ifdef _WIN32
-      HMODULE intl_dll = LoadLibrary ("intl.dll");
-#elif defined(__APPLE__) && defined(__MACH__)
-      HMODULE intl_dll = dlopen ("libintl.dylib", RTLD_LAZY);
-#else
-      HMODULE intl_dll = dlopen ("libintl.so", RTLD_LAZY);
-#endif
+#if !STUB_ONLY
+#  ifdef _WIN32
+    HMODULE intl_dll = LoadLibrary ("intl.dll");
+#  elif defined(__APPLE__) && defined(__MACH__)
+    HMODULE intl_dll = dlopen ("libintl.dylib", RTLD_LAZY);
+#  else
+    HMODULE intl_dll = dlopen ("libintl.so", RTLD_LAZY);
+#  endif
+#else  /* !STUB_ONLY */
+    HMODULE intl_dll = NULL;
+#endif  /* STUB_ONLY */
 
       if (intl_dll != NULL &&
 	  use_intl_dll (intl_dll))