configure, darwin: favor -faltivec over -maltivec. don't -faltivec for others. SDL-1.2
authorOzkan Sezer <sezeroz@gmail.com>
Sat, 07 Sep 2019 10:37:28 +0300
branchSDL-1.2
changeset 130684a2c30be1127
parent 13067 654469bd1d06
child 13072 eb4b37ea05f6
configure, darwin: favor -faltivec over -maltivec. don't -faltivec for others.
configure
configure.in
     1.1 --- a/configure	Fri Sep 06 20:00:40 2019 +0300
     1.2 +++ b/configure	Sat Sep 07 10:37:28 2019 +0300
     1.3 @@ -23111,122 +23111,6 @@
     1.4              { $as_echo "$as_me:$LINENO: result: $have_gcc_altivec" >&5
     1.5  $as_echo "$have_gcc_altivec" >&6; }
     1.6          fi
     1.7 -
     1.8 -        if test x$have_gcc_altivec = xno; then
     1.9 -            { $as_echo "$as_me:$LINENO: checking for Altivec with GCC altivec.h and -faltivec option" >&5
    1.10 -$as_echo_n "checking for Altivec with GCC altivec.h and -faltivec option... " >&6; }
    1.11 -            altivec_CFLAGS="-faltivec"
    1.12 -            CFLAGS="$save_CFLAGS $altivec_CFLAGS"
    1.13 -            cat >conftest.$ac_ext <<_ACEOF
    1.14 -/* confdefs.h.  */
    1.15 -_ACEOF
    1.16 -cat confdefs.h >>conftest.$ac_ext
    1.17 -cat >>conftest.$ac_ext <<_ACEOF
    1.18 -/* end confdefs.h.  */
    1.19 -
    1.20 -            #include <altivec.h>
    1.21 -            vector unsigned int vzero() {
    1.22 -                return vec_splat_u32(0);
    1.23 -            }
    1.24 -
    1.25 -int
    1.26 -main ()
    1.27 -{
    1.28 -
    1.29 -
    1.30 -  ;
    1.31 -  return 0;
    1.32 -}
    1.33 -_ACEOF
    1.34 -rm -f conftest.$ac_objext
    1.35 -if { (ac_try="$ac_compile"
    1.36 -case "(($ac_try" in
    1.37 -  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
    1.38 -  *) ac_try_echo=$ac_try;;
    1.39 -esac
    1.40 -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
    1.41 -$as_echo "$ac_try_echo") >&5
    1.42 -  (eval "$ac_compile") 2>conftest.er1
    1.43 -  ac_status=$?
    1.44 -  grep -v '^ *+' conftest.er1 >conftest.err
    1.45 -  rm -f conftest.er1
    1.46 -  cat conftest.err >&5
    1.47 -  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
    1.48 -  (exit $ac_status); } && {
    1.49 -	 test -z "$ac_c_werror_flag" ||
    1.50 -	 test ! -s conftest.err
    1.51 -       } && test -s conftest.$ac_objext; then
    1.52 -
    1.53 -            have_gcc_altivec=yes
    1.54 -            have_altivec_h_hdr=yes
    1.55 -
    1.56 -else
    1.57 -  $as_echo "$as_me: failed program was:" >&5
    1.58 -sed 's/^/| /' conftest.$ac_ext >&5
    1.59 -
    1.60 -
    1.61 -fi
    1.62 -
    1.63 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    1.64 -            { $as_echo "$as_me:$LINENO: result: $have_gcc_altivec" >&5
    1.65 -$as_echo "$have_gcc_altivec" >&6; }
    1.66 -        fi
    1.67 -
    1.68 -        if test x$have_gcc_altivec = xno; then
    1.69 -            { $as_echo "$as_me:$LINENO: checking for Altivec with GCC -faltivec option" >&5
    1.70 -$as_echo_n "checking for Altivec with GCC -faltivec option... " >&6; }
    1.71 -            cat >conftest.$ac_ext <<_ACEOF
    1.72 -/* confdefs.h.  */
    1.73 -_ACEOF
    1.74 -cat confdefs.h >>conftest.$ac_ext
    1.75 -cat >>conftest.$ac_ext <<_ACEOF
    1.76 -/* end confdefs.h.  */
    1.77 -
    1.78 -            vector unsigned int vzero() {
    1.79 -                return vec_splat_u32(0);
    1.80 -            }
    1.81 -
    1.82 -int
    1.83 -main ()
    1.84 -{
    1.85 -
    1.86 -
    1.87 -  ;
    1.88 -  return 0;
    1.89 -}
    1.90 -_ACEOF
    1.91 -rm -f conftest.$ac_objext
    1.92 -if { (ac_try="$ac_compile"
    1.93 -case "(($ac_try" in
    1.94 -  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
    1.95 -  *) ac_try_echo=$ac_try;;
    1.96 -esac
    1.97 -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
    1.98 -$as_echo "$ac_try_echo") >&5
    1.99 -  (eval "$ac_compile") 2>conftest.er1
   1.100 -  ac_status=$?
   1.101 -  grep -v '^ *+' conftest.er1 >conftest.err
   1.102 -  rm -f conftest.er1
   1.103 -  cat conftest.err >&5
   1.104 -  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   1.105 -  (exit $ac_status); } && {
   1.106 -	 test -z "$ac_c_werror_flag" ||
   1.107 -	 test ! -s conftest.err
   1.108 -       } && test -s conftest.$ac_objext; then
   1.109 -
   1.110 -            have_gcc_altivec=yes
   1.111 -
   1.112 -else
   1.113 -  $as_echo "$as_me: failed program was:" >&5
   1.114 -sed 's/^/| /' conftest.$ac_ext >&5
   1.115 -
   1.116 -
   1.117 -fi
   1.118 -
   1.119 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.120 -            { $as_echo "$as_me:$LINENO: result: $have_gcc_altivec" >&5
   1.121 -$as_echo "$have_gcc_altivec" >&6; }
   1.122 -        fi
   1.123          CFLAGS="$save_CFLAGS"
   1.124  
   1.125          if test x$have_gcc_altivec = xyes; then
   1.126 @@ -23245,6 +23129,89 @@
   1.127      fi
   1.128  }
   1.129  
   1.130 +CheckAltivecApple()
   1.131 +{
   1.132 +    # Check whether --enable-altivec was given.
   1.133 +if test "${enable_altivec+set}" = set; then
   1.134 +  enableval=$enable_altivec;
   1.135 +else
   1.136 +  enable_altivec=yes
   1.137 +fi
   1.138 +
   1.139 +    if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_altivec = xyes; then
   1.140 +        save_CFLAGS="$CFLAGS"
   1.141 +        have_gcc_altivec=no
   1.142 +        altivec_CFLAGS="-faltivec"
   1.143 +        CFLAGS="$save_CFLAGS $altivec_CFLAGS"
   1.144 +
   1.145 +                        { $as_echo "$as_me:$LINENO: checking for Altivec with GCC -faltivec option" >&5
   1.146 +$as_echo_n "checking for Altivec with GCC -faltivec option... " >&6; }
   1.147 +        cat >conftest.$ac_ext <<_ACEOF
   1.148 +/* confdefs.h.  */
   1.149 +_ACEOF
   1.150 +cat confdefs.h >>conftest.$ac_ext
   1.151 +cat >>conftest.$ac_ext <<_ACEOF
   1.152 +/* end confdefs.h.  */
   1.153 +
   1.154 +        vector unsigned int vzero() {
   1.155 +            return vec_splat_u32(0);
   1.156 +        }
   1.157 +
   1.158 +int
   1.159 +main ()
   1.160 +{
   1.161 +
   1.162 +
   1.163 +  ;
   1.164 +  return 0;
   1.165 +}
   1.166 +_ACEOF
   1.167 +rm -f conftest.$ac_objext
   1.168 +if { (ac_try="$ac_compile"
   1.169 +case "(($ac_try" in
   1.170 +  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   1.171 +  *) ac_try_echo=$ac_try;;
   1.172 +esac
   1.173 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
   1.174 +$as_echo "$ac_try_echo") >&5
   1.175 +  (eval "$ac_compile") 2>conftest.er1
   1.176 +  ac_status=$?
   1.177 +  grep -v '^ *+' conftest.er1 >conftest.err
   1.178 +  rm -f conftest.er1
   1.179 +  cat conftest.err >&5
   1.180 +  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   1.181 +  (exit $ac_status); } && {
   1.182 +	 test -z "$ac_c_werror_flag" ||
   1.183 +	 test ! -s conftest.err
   1.184 +       } && test -s conftest.$ac_objext; then
   1.185 +
   1.186 +        have_gcc_altivec=yes
   1.187 +
   1.188 +else
   1.189 +  $as_echo "$as_me: failed program was:" >&5
   1.190 +sed 's/^/| /' conftest.$ac_ext >&5
   1.191 +
   1.192 +
   1.193 +fi
   1.194 +
   1.195 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.196 +        { $as_echo "$as_me:$LINENO: result: $have_gcc_altivec" >&5
   1.197 +$as_echo "$have_gcc_altivec" >&6; }
   1.198 +
   1.199 +        CFLAGS="$save_CFLAGS"
   1.200 +
   1.201 +        if test x$have_gcc_altivec = xyes; then
   1.202 +            cat >>confdefs.h <<\_ACEOF
   1.203 +#define SDL_ALTIVEC_BLITTERS 1
   1.204 +_ACEOF
   1.205 +
   1.206 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
   1.207 +        else
   1.208 +                    CheckAltivec
   1.209 +        fi
   1.210 +    fi
   1.211 +}
   1.212 +
   1.213  CheckVisibilityHidden()
   1.214  {
   1.215      { $as_echo "$as_me:$LINENO: checking for GCC -fvisibility=hidden option" >&5
   1.216 @@ -31124,7 +31091,7 @@
   1.217          CheckMacGL
   1.218          CheckOpenGLX11
   1.219          CheckPTHREAD
   1.220 -        CheckAltivec
   1.221 +        CheckAltivecApple
   1.222  
   1.223          # Need this or things might misbuild on a G3.
   1.224          EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
     2.1 --- a/configure.in	Fri Sep 06 20:00:40 2019 +0300
     2.2 +++ b/configure.in	Sat Sep 07 10:37:28 2019 +0300
     2.3 @@ -844,36 +844,6 @@
     2.4              ])
     2.5              AC_MSG_RESULT($have_gcc_altivec)
     2.6          fi
     2.7 -
     2.8 -        if test x$have_gcc_altivec = xno; then
     2.9 -            AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
    2.10 -            altivec_CFLAGS="-faltivec"
    2.11 -            CFLAGS="$save_CFLAGS $altivec_CFLAGS"
    2.12 -            AC_TRY_COMPILE([
    2.13 -            #include <altivec.h>
    2.14 -            vector unsigned int vzero() {
    2.15 -                return vec_splat_u32(0);
    2.16 -            }
    2.17 -            ],[
    2.18 -            ],[
    2.19 -            have_gcc_altivec=yes
    2.20 -            have_altivec_h_hdr=yes
    2.21 -            ])
    2.22 -            AC_MSG_RESULT($have_gcc_altivec)
    2.23 -        fi
    2.24 -
    2.25 -        if test x$have_gcc_altivec = xno; then
    2.26 -            AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
    2.27 -            AC_TRY_COMPILE([
    2.28 -            vector unsigned int vzero() {
    2.29 -                return vec_splat_u32(0);
    2.30 -            }
    2.31 -            ],[
    2.32 -            ],[
    2.33 -            have_gcc_altivec=yes
    2.34 -            ])
    2.35 -            AC_MSG_RESULT($have_gcc_altivec)
    2.36 -        fi
    2.37          CFLAGS="$save_CFLAGS"
    2.38  
    2.39          if test x$have_gcc_altivec = xyes; then
    2.40 @@ -886,6 +856,43 @@
    2.41      fi
    2.42  }
    2.43  
    2.44 +dnl Check for altivec instruction support - APPLE extensions
    2.45 +CheckAltivecApple()
    2.46 +{
    2.47 +    AC_ARG_ENABLE(altivec,
    2.48 +AC_HELP_STRING([--enable-altivec], [use altivec assembly blitters on PPC [[default=yes]]]),
    2.49 +                  , enable_altivec=yes)
    2.50 +    if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_altivec = xyes; then
    2.51 +        save_CFLAGS="$CFLAGS"
    2.52 +        have_gcc_altivec=no
    2.53 +        altivec_CFLAGS="-faltivec"
    2.54 +        CFLAGS="$save_CFLAGS $altivec_CFLAGS"
    2.55 +
    2.56 +        dnl -faltivec doesn't need altivec.h and actually
    2.57 +        dnl  emits a warning if included..
    2.58 +        AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
    2.59 +        AC_TRY_COMPILE([
    2.60 +        vector unsigned int vzero() {
    2.61 +            return vec_splat_u32(0);
    2.62 +        }
    2.63 +        ],[
    2.64 +        ],[
    2.65 +        have_gcc_altivec=yes
    2.66 +        ])
    2.67 +        AC_MSG_RESULT($have_gcc_altivec)
    2.68 +
    2.69 +        CFLAGS="$save_CFLAGS"
    2.70 +
    2.71 +        if test x$have_gcc_altivec = xyes; then
    2.72 +            AC_DEFINE(SDL_ALTIVEC_BLITTERS)
    2.73 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
    2.74 +        else
    2.75 +        dnl Check standart gcc altivec options
    2.76 +            CheckAltivec
    2.77 +        fi
    2.78 +    fi
    2.79 +}
    2.80 +
    2.81  dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
    2.82  dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
    2.83  CheckVisibilityHidden()
    2.84 @@ -2785,7 +2792,7 @@
    2.85          CheckMacGL
    2.86          CheckOpenGLX11
    2.87          CheckPTHREAD
    2.88 -        CheckAltivec
    2.89 +        CheckAltivecApple
    2.90  
    2.91          # Need this or things might misbuild on a G3.
    2.92          EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"