+#ifdef __APPLE__
+#if defined(__x86_64__)
+#define USR_BIN_ARCH_SWITCH "-x86_64"
+#elif defined(__i386__)
+#define USR_BIN_ARCH_SWITCH "-i386"
+#elif defined(__ppc__)
+#define USR_BIN_ARCH_SWITCH "-ppc"
+#elif defined(__ppc64__)
+#define USR_BIN_ARCH_SWITCH "-ppc64"
+#endif
+#endif
+
+#define YES_MULTIARCH 1
+#define NO_MULTIARCH 2
+
+#if defined (__APPLE__) && defined (USR_BIN_ARCH_SWITCH)
+static gboolean
+gst_plugin_loader_use_usr_bin_arch (void)
+{
+ static volatile gsize multiarch = 0;
+
+ if (g_once_init_enter (&multiarch)) {
+ gsize res = NO_MULTIARCH;
+
+#ifdef HAVE_SYS_UTSNAME_H
+ {
+ struct utsname uname_data;
+
+ if (uname (&uname_data) == 0) {
+ /* Check for OS X >= 10.5 (darwin kernel 9.0) */
+ GST_LOG ("%s %s", uname_data.sysname, uname_data.release);
+ if (g_ascii_strcasecmp (uname_data.sysname, "Darwin") == 0 &&
+ g_strtod (uname_data.release, NULL) >= 9.0) {
+ res = YES_MULTIARCH;
+ }
+ }
+ }
+#endif
+
+ GST_INFO ("multiarch: %s", (res == YES_MULTIARCH) ? "yes" : "no");
+ g_once_init_leave (&multiarch, res);
+ }
+ return (multiarch == YES_MULTIARCH);
+}
+#endif /* __APPLE__ && USR_BIN_ARCH_SWITCH */
+