pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

x11/openmotif weak aliases build error on Darwin with clang



The x11/openmotif package fails to build for me on Darwin (Mac OS X
10.8.4) using clang (Apple LLVM version 4.2 (clang-425.0.28) (based on
LLVM 3.2svn)).  It is failing because clang does not support weak
aliases.

I've created an upstream bug report at

  http://bugs.motifzone.net/show_bug.cgi?id=1625

The bug report includes patches to fix the problem.  The fix is to add a
weak-aliases-support test to Autoconf to test whether the compiler
supports weak aliases.

I've created similar patches against the pkgsrc package and attached
them to this email.  distinfo.patch is a patch against the distinfo file
to make it aware of the new patch files.  The patch-* files should be
placed in the patches directory of the package.

Could these changes be committed to the pkgsrc tree?

Thanks,

Lewis
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/x11/openmotif/distinfo,v
retrieving revision 1.31
diff -b -u -r1.31 distinfo
--- distinfo    9 Nov 2012 16:46:50 -0000       1.31
+++ distinfo    5 Sep 2013 20:43:59 -0000
@@ -6,6 +6,7 @@
 SHA1 (patch-aa) = bbd5e51128e565d36d4b88260ba634bf6a7df61c
 SHA1 (patch-ab) = b9662c99b008e6490dc61cabe36cf952c87b51b1
 SHA1 (patch-ac) = 1c14d22f888859b15365bcba7edba78a1114c6ac
+SHA1 (patch-acinclude.m4) = 1eff81a709a0c0380ec0dfc088bce71da6845b8d
 SHA1 (patch-ae) = 00ffe019ea7a6950ed673f5a7907196b22a45f4e
 SHA1 (patch-ah) = 901ba95f037bb987f2411b3661359e3f414906c5
 SHA1 (patch-aj) = 28dd5d30ebbb7a4ea6da03a4befd026a7dd01cef
@@ -18,4 +19,8 @@
 SHA1 (patch-bn) = c5f58ebfe54d230d25936e29de0c7aebe40aa11b
 SHA1 (patch-bo) = a1b2ab6cdaac779116f262519a42901c8effb9db
 SHA1 (patch-bp) = 4efeb0da29a691dea4c3c7738fba52a25843c0de
+SHA1 (patch-configure) = b5a432089631809548824fdccd9b0faa7f15dcb0
+SHA1 (patch-configure.ac) = fd623ea22aa10d0c21143bcadb46057f1c808412
+SHA1 (patch-include_config.h.in) = 58c9b6784191166e2af3e2f390575a8557050109
+SHA1 (patch-lib_Xm_XmP.h) = 23512cfc038fee6899a97a79287c8b6936912c02
 SHA1 (patch-lib_Xm_Xmfuncs.h) = 8ca6059000cde2e31d185264f21b04b2c5433f6f
Fix build using clang compiler on Darwin (Mac OS X 10.8.4) by not using weak
aliases if the compiler does not support them.

Upstream bug report:

  http://bugs.motifzone.net/show_bug.cgi?id=1625

--- acinclude.m4.orig   2004-12-07 05:36:31.000000000 -0600
+++ acinclude.m4        2013-09-04 21:34:23.000000000 -0500
@@ -3,6 +3,7 @@
 dnl
 dnl     LT_LIB_XTHREADS
 dnl    AM_FUNC_VOID_SPRINTF
+dnl    WEAK_ALIAS_SUPPORT
 dnl
 
 dnl This should be the canonical approach to check for XTHREADS.
@@ -57,6 +58,22 @@
 fi
 ])
 
+dnl This tests whether weak aliases are supported.
+AC_DEFUN([WEAK_ALIAS_SUPPORT],
+[AC_CACHE_CHECK(whether weak aliases are supported, ac_cv_weak_alias_support,
+[AC_TRY_COMPILE([
+int get_value(int *value) {
+  return *value;
+}
+int get_value_alias(int *high) __attribute__((__weak__,alias("get_value")));
+],
+[],
+ac_cv_weak_alias_support=yes,
+ac_cv_weak_alias_support=no)])
+if test $ac_cv_weak_alias_support = no; then
+  AC_DEFINE(NO_WEAK_ALIASES,1,[Define if weak aliases are not supported])
+fi
+])
 
 dnl
 dnl End of special macros.
Fix build using clang compiler on Darwin (Mac OS X 10.8.4) by not using weak
aliases if the compiler does not support them.

Upstream bug report:

  http://bugs.motifzone.net/show_bug.cgi?id=1625

--- configure.orig      2010-03-12 08:44:09.000000000 -0600
+++ configure   2013-09-04 21:17:53.000000000 -0500
@@ -16423,6 +16423,69 @@
 
 fi
 
+{ $as_echo "$as_me:$LINENO: checking whether weak aliases are supported" >&5
+$as_echo_n "checking whether weak aliases are supported... " >&6; }
+if test "${ac_cv_weak_alias_support+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int get_value(int *value) {
+  return *value;
+}
+int get_value_alias(int *high) __attribute__((weak,alias("get_value")));
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_weak_alias_support=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_weak_alias_support=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_weak_alias_support" >&5
+$as_echo "$ac_cv_weak_alias_support" >&6; }
+if test $ac_cv_weak_alias_support = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_WEAK_ALIASES 1
+_ACEOF
+
+fi
+
 
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
Fix build using clang compiler on Darwin (Mac OS X 10.8.4) by not using weak
aliases if the compiler does not support them.

Upstream bug report:

  http://bugs.motifzone.net/show_bug.cgi?id=1625

--- configure.ac.orig   2009-10-27 11:10:23.000000000 -0500
+++ configure.ac        2013-09-04 18:02:30.000000000 -0500
@@ -110,6 +110,7 @@
 AC_HEADER_TIME
 AC_STRUCT_TM
 AC_TYPE_UID_T
+WEAK_ALIAS_SUPPORT
 
 dnl Checks for library functions.
 AC_FUNC_ALLOCA
Fix build using clang compiler on Darwin (Mac OS X 10.8.4) by not using weak
aliases if the compiler does not support them.

Upstream bug report:

  http://bugs.motifzone.net/show_bug.cgi?id=1625

--- include/config.h.in.orig    2010-03-12 08:59:14.000000000 -0600
+++ include/config.h.in 2013-09-04 21:51:21.000000000 -0500
@@ -293,6 +293,9 @@
 /* no regcmp */
 #undef NO_REGCOMP
 
+/* Define if weak aliases are not supported */
+#undef NO_WEAK_ALIASES
+
 /* Compatibility with OpenMotif 2.2 */
 #undef OM22_COMPATIBILITY
 
Fix build using clang compiler on Darwin (Mac OS X 10.8.4) by not using weak
aliases if the compiler does not support them.

Upstream bug report:

  http://bugs.motifzone.net/show_bug.cgi?id=1625

--- lib/Xm/XmP.h.orig   2010-01-20 10:57:24.000000000 -0600
+++ lib/Xm/XmP.h        2013-09-04 21:32:49.000000000 -0500
@@ -1457,7 +1457,11 @@
 
 #if __GNUC__
 #  define XM_DEPRECATED  __attribute__((__deprecated__))
+#  ifdef NO_WEAK_ALIASES
+#    define XM_ALIAS(sym)
+#  else
 #  define XM_ALIAS(sym)  __attribute__((__weak__,alias(#sym)))
+#  endif
 #else
 #  define XM_DEPRECATED
 #  define XM_ALIAS(sym)


Home | Main Index | Thread Index | Old Index