tech-pkg archive

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

libmpeg2 fix for ppc



Hi,

configure for libmpeg2 manages to not define HAVE_ALTIVEC_H,
because, apparently,

typedef vector int t;
int
main()
{
        vec_ld(0, (unsigned char*) 0);
}

manages to build without errors.  So ... I reverse the sequence
of testing, and first try to do that *with* <altivec.h>, and that
causes HAVE_ALTIVEC_H to be defined and makes the build complete
on NetBSD/macppc -current.

Proposed diff attached below.

I'm also patching configure.ac, showing the intent, but configure
is still hand-patched (I could not get aclocal + autoconf to
generate a working configure script).

Without this, I get

motion_comp_altivec.c: In function 'my_vec_ld':
motion_comp_altivec.c:48:12: warning: implicit declaration of function 'vec_ld';
 did you mean 'my_vec_ld'? [-Wimplicit-function-declaration]
   48 |     return vec_ld (A, (uint8_t *)B);
      |            ^~~~~~
      |            my_vec_ld
motion_comp_altivec.c:48:12: warning: nested extern declaration of 'vec_ld' [-Wnested-externs]
motion_comp_altivec.c:48:23: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
   48 |     return vec_ld (A, (uint8_t *)B);
      |                       ^
motion_comp_altivec.c:48:12: error: incompatible types when returning type 'int' but 'vector_u8_t' {aka '__vector(16) unsigned char'} was expected
   48 |     return vec_ld (A, (uint8_t *)B);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~

and lots of similar errors.

Regards,

- Håvard
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/multimedia/libmpeg2/distinfo,v
retrieving revision 1.15
diff -u -p -r1.15 distinfo
--- distinfo	26 Oct 2021 11:01:09 -0000	1.15
+++ distinfo	21 Jun 2022 17:17:28 -0000
@@ -3,5 +3,6 @@ $NetBSD: distinfo,v 1.15 2021/10/26 11:0
 BLAKE2s (libmpeg2-0.5.1.tar.gz) = 052e01bcc751539f594f48d9b370fc2dc0ca0bda86e94c041eb2e1ef2270d3d4
 SHA512 (libmpeg2-0.5.1.tar.gz) = 3648a2b3d7e2056d5adb328acd2fb983a1fa9a05ccb6f9388cc686c819445421811f42e8439418a0491a13080977f074a0d8bf8fa6bc101ff245ddea65a46fbc
 Size (libmpeg2-0.5.1.tar.gz) = 524776 bytes
-SHA1 (patch-aa) = 6e6d47232ba20a307ac3a378b09fb08b50f80445
+SHA1 (patch-aa) = 925383d3e5eab74ba2b37d9def5a270ad0def3fc
 SHA1 (patch-ab) = e732e35208eb62101f54bbf4a7800a3c4cf9adf0
+SHA1 (patch-configure.ac) = 05620d548994cf8e1125a816c545a9b12c5c2cd8
Index: patches/patch-aa
===================================================================
RCS file: /cvsroot/pkgsrc/multimedia/libmpeg2/patches/patch-aa,v
retrieving revision 1.6
diff -u -p -r1.6 patch-aa
--- patches/patch-aa	7 Aug 2008 18:23:18 -0000	1.6
+++ patches/patch-aa	21 Jun 2022 17:17:28 -0000
@@ -11,3 +11,50 @@ $NetBSD: patch-aa,v 1.6 2008/08/07 18:23
      { echo "$as_me:$LINENO: checking if $CC supports $TRY_CFLAGS flags" >&5
  echo $ECHO_N "checking if $CC supports $TRY_CFLAGS flags... $ECHO_C" >&6; }
      SAVE_CFLAGS="$CFLAGS"
+@@ -4981,6 +4981,7 @@ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h.  */
+ 
++#include <altivec.h>
+ int
+ main ()
+ {
+@@ -5007,8 +5008,12 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec
+ 	 test -z "$ac_c_werror_flag" ||
+ 	 test ! -s conftest.err
+        } && test -s conftest.$ac_objext; then
+-  have_altivec=yes; { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++cat >>confdefs.h <<\_ACEOF
++#define HAVE_ALTIVEC_H
++_ACEOF
++
++			 have_altivec=yes; { echo "$as_me:$LINENO: result: yes" >&5
++echo "${ECHO_T}yes" >&6; }
+ else
+   echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' conftest.$ac_ext >&5
+@@ -5019,7 +5024,6 @@ _ACEOF
+ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h.  */
+-#include <altivec.h>
+ int
+ main ()
+ {
+@@ -5045,13 +5049,8 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec
+ 	 test -z "$ac_c_werror_flag" ||
+ 	 test ! -s conftest.err
+        } && test -s conftest.$ac_objext; then
+-
+-cat >>confdefs.h <<\_ACEOF
+-#define HAVE_ALTIVEC_H
+-_ACEOF
+-
+-			 have_altivec=yes; { echo "$as_me:$LINENO: result: yes" >&5
+-echo "${ECHO_T}yes" >&6; }
++  have_altivec=yes; { echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6; }
+ else
+   echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' conftest.$ac_ext >&5
--- /dev/null	2022-06-21 19:15:13.856106752 +0200
+++ patches/patch-configure.ac	2022-06-21 18:59:54.963928248 +0200
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- configure.ac.orig	2008-07-18 14:30:17.000000000 +0000
++++ configure.ac
+@@ -41,7 +41,7 @@ elif test x"$GCC" = x"yes"; then
+     changequote(<<,>>)
+     TRY_CFLAGS=`echo "$OPT_CFLAGS $CFLAGS"|sed "s/-O[0-9]*//g"`
+     changequote([,])
+-    TRY_CFLAGS="$TRY_CFLAGS -O3"
++    TRY_CFLAGS="$TRY_CFLAGS $CFLAGS"
+     AC_TRY_CFLAGS([$TRY_CFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"])
+ 
+     AC_ARG_ENABLE([debug],
+@@ -78,15 +78,15 @@ elif test x"$GCC" = x"yes"; then
+ 		[save_CFLAGS="$CFLAGS"
+ 		 CFLAGS="$OPT_CFLAGS $TRY_CFLAGS $CFLAGS"
+ 		 AC_MSG_CHECKING([if <altivec.h> is needed])
+-		 AC_TRY_COMPILE([],
+-		    [typedef vector int t;
+-		     vec_ld(0, (unsigned char *)0);],
+-		    [have_altivec=yes; AC_MSG_RESULT(no)],
+-		    [AC_TRY_COMPILE([#include <altivec.h>],
++		 [AC_TRY_COMPILE([#include <altivec.h>],
+ 			[typedef vector int t; vec_ld(0, (unsigned char *)0);],
+ 			[AC_DEFINE([HAVE_ALTIVEC_H],,
+ 			    [Define to 1 if you have the <altivec.h> header.])
+ 			 have_altivec=yes; AC_MSG_RESULT(yes)],
++			 AC_TRY_COMPILE([],
++			    [typedef vector int t;
++			     vec_ld(0, (unsigned char *)0);],
++			    [have_altivec=yes; AC_MSG_RESULT(no)],
+ 			[AC_MSG_RESULT(unsupported)])])
+ 		 CFLAGS="$save_CFLAGS"])
+ 	    if test "$have_altivec" = "yes"; then


Home | Main Index | Thread Index | Old Index