[x264-devel] [patch] improve install process

Tim Mooney Tim.Mooney at ndsu.edu
Fri Jan 6 00:02:32 CET 2012


In regard to: Re: [x264-devel] [patch] improve install process, Jason...:

> On Fri, Dec 30, 2011 at 3:49 PM, Tim Mooney <Tim.Mooney at ndsu.edu> wrote:
>>
>> [I'm not subscribed to the mailing list, so please Cc: me on any responses,
>> assuming the moderator approves this post]
>>
>> I recently built a libx264 snapshot on my x86_64-sun-solaris2.10 workstation
>> using the no-cost Oracle/Sun Workshop compiler.  I have
>> a couple patches that improved the configure & build process for me,
>> the first of which is below my signature.  The longer patch will be in
>> a separate email.
>
> Your mailer appears to have garbled this patch in some fashion, as it
> won't apply.  Can you just attach it directly?

Happily!

Sorry for the trouble and thanks for considering the patch.

Tim
-- 
Tim Mooney                                             Tim.Mooney at ndsu.edu
Enterprise Computing & Infrastructure                  701-231-1076 (Voice)
Room 242-J6, IACC Building                             701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164
-------------- next part --------------
--- x264-snapshot-20111228-2245.orig/configure	2011-12-28 15:45:03.000000000 -0600
+++ x264-snapshot-20111228-2245/configure	2011-12-30 16:57:02.071786398 -0600
@@ -110,6 +110,24 @@
     done
 }
 
+
+suncc_cflags() {
+    log_msg "Filtering CFLAGS for Sun Workshop compiler"
+    # Filter out some of the gcc flags that the Sun/Oracle Workshop compiler
+    # doesn't understand.  Many of these are modeled after intel_cflags()
+    for arg in $*; do
+        [ "$arg" = -falign-loops        ] && arg=
+        [ "$arg" = -ffast-math          ] && arg='-xlibmopt -fround=nearest '
+        [ "$arg" = -fno-tree-vectorize  ] && arg=
+        [ "$arg" = -fomit-frame-pointer ] && arg=
+        [ "$arg" = -fPIC                ] && arg=-KPIC
+        [ "$arg" = -g                   ] && arg='-g -xs '
+        [ "$arg" = -Wall                ] && arg=-errtags=yes
+        [ "$arg" = -Wshadow             ] && arg=
+        [ -n "$arg"                     ] && echo -n "$arg "
+    done
+}
+
 cc_check() {
     if [ -z "$3" ]; then
         if [ -z "$1$2" ]; then
@@ -391,6 +410,8 @@
 host_vendor="${host%%-*}"
 host_os="${host#*-}"
 
+log_msg "host=$host, host_os=$host_os, host_cpu=$host_cpu"
+
 # test for use of Intel Compiler
 if [[ $host_os = mingw* || $host_os = cygwin* ]]; then
     if [[ `basename "$CC"` = icl* ]]; then
@@ -403,6 +424,15 @@
         `$CC 2>&1 | grep -q "Intel(R) 64"` && host_cpu=x86_64
         cpp_check "" "" "_MSC_VER >= 1400" || die "Windows Intel Compiler support requires Visual Studio 2005 or newer"
     fi
+elif [[ $host_os = solaris* ]]; then
+    log_msg "Host is solaris"
+    if `$CC -V 2>&1 | grep 'Sun C' >/dev/null` ; then
+        log_msg "Compiler is suncc, filtering CFLAGS"
+        compiler=suncc
+        CFLAGS="$(suncc_cflags $CFLAGS)"
+        CFLAGS="$CFLAGS -Xa -xc99=all"
+        log_msg "After filtering CFLAGS=$CFLAGS"
+    fi
 else
     if [[ `basename "$CC"` = icc* ]]; then
         AR="xiar"
@@ -616,7 +647,7 @@
 
 cc_check || die "No working C compiler found."
 
-if [ $compiler != ICL ]; then
+if [ $compiler != ICL -a $compiler != suncc ]; then
     if cc_check '' -std=gnu99 'for( int i = 0; i < 9; i++ );' ; then
         CFLAGS="$CFLAGS -std=gnu99"
     elif cc_check '' -std=c99 'for( int i = 0; i < 9; i++ );' ; then
@@ -741,6 +772,8 @@
 
 if cc_check "math.h" "-Werror" "return log2f(2);" ; then
     define HAVE_LOG2F
+elif cc_check "math.h" "-errwarn=%all" "return log2f(2);" ; then
+    define HAVE_LOG2F
 fi
 
 if [ "$vis" = "yes" ] ; then
@@ -876,7 +909,7 @@
     ASFLAGS="$ASFLAGS -DPIC"
     # resolve textrels in the x86 asm
     cc_check stdio.h "-shared -Wl,-Bsymbolic" && SOFLAGS="$SOFLAGS -Wl,-Bsymbolic"
-    [ $SYS = SunOS -a "$ARCH" = "X86" ] && SOFLAGS="$SOFLAGS -mimpure-text"
+    [ $SYS = SunOS -a "$ARCH" = "X86" -a $compiler != suncc ] && SOFLAGS="$SOFLAGS -mimpure-text"
 fi
 
 if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
@@ -959,6 +992,14 @@
     else
         CFLAGS="-DNDEBUG $CFLAGS"
     fi
+elif [ $compiler = suncc ]; then
+	AR="$AR rc "
+	DEPMM="-xM1"
+	DEPMT="-xM1"
+	LD="$CC -o "
+	LIBX264=libx264.a
+	# ranlib isn't needed, ar does it
+	RANLIB=
 else
     AR="$AR rc "
     DEPMM="-MM -g0"
@@ -971,6 +1011,8 @@
     PROF_GEN_LD="-fprofile-generate"
     PROF_USE_CC="-fprofile-use"
     PROF_USE_LD="-fprofile-use"
+elif [ $compiler = suncc ]; then
+    CFLAGS="$(suncc_cflags $CFLAGS)"
 else
     CFLAGS="$(intel_cflags $CFLAGS)"
     # icc does not define __SSE__ until SSE2 optimization and icl never defines it or _M_IX86_FP


More information about the x264-devel mailing list