[x264-devel] [patch] preliminary irix support

hbent at cs.oberlin.edu hbent at cs.oberlin.edu
Wed May 7 09:27:48 CEST 2008


> hbent at cs.oberlin.edu a écrit :
>
>> -IRIX doesn't have getopt_long, and HAVE_GETOPT_LONG=0 doesn't provide
>> it.
>>  I suspect this also breaks compilation on SPARC Solaris.  I am working
>> on
>> this, and will send along a patch in a separate email.
>
> Neither MSVC.
> In extra/getopt.c getopt_long is defined for the getopt_long-disabled
> platforms (right now only msvc).

Right, getopt_long is only defined if _MSVC is defined, which is not what
we want.  I fixed this but I'm not 100% sure that I did it the right way.

Also, during testing I realized that I was including a local getopt.h,
which was masking errors like:

x264.c: In function 'Parse':
x264.c:370: error: array type has incomplete element type
x264.c:372: error: 'no_argument' undeclared (first use in this function)
x264.c:372: error: (Each undeclared identifier is reported only once
x264.c:372: error: for each function it appears in.)
x264.c:375: error: 'required_argument' undeclared (first use in this
function)
x264.c:475: warning: implicit declaration of function 'getopt_long'
x264.c:370: warning: unused variable 'long_options'

I fixed that problem too, and I have attached another patch.  This patch
plus the original gives a fully working x264 on IRIX.

-Henry Bent


--- x264.c.orig 2008-04-22 16:59:30.000000000 -0400
+++ x264.c      2008-05-07 03:14:26.571228080 -0400
@@ -26,7 +26,12 @@

 #include <signal.h>
 #define _GNU_SOURCE
+
+#if (HAVE_GETOPT_LONG == 0)
+#include "extras/getopt.h"
+#else
 #include <getopt.h>
+#endif

 #include "common/common.h"
 #include "common/cpu.h"


--- getopt.c.orig       2008-03-04 17:27:18.000000000 -0500
+++ getopt.c    2008-05-07 03:00:45.993784240 -0400
@@ -994,6 +994,17 @@

 #endif

+#if (HAVE_GETOPT_LONG == 0)
+
+int
+getopt_long (int argc, char *const *argv, const char *shortopts, const
+       struct option *longopts, int *longind)
+{
+  return _getopt_internal (argc, argv, shortopts, longopts, longind, 0);
+}
+
+#endif
+
 #endif /* Not ELIDE_CODE.  */


 #ifdef TEST





More information about the x264-devel mailing list