--- m4/optimizations.m4.orig 2008-09-15 15:09:45.000000000 -0700 +++ m4/optimizations.m4 2008-09-15 15:09:58.000000000 -0700 @@ -2,7 +2,9 @@ if test x_$sah_opt_only_once = x_ ; then sah_opt_only_once=all_done - +OPT_CFLAGS="" +OPT_LDFLAGS="" + AC_ARG_ENABLE([sse3], AC_HELP_STRING([--enable-sse3], [Use SSE3 optimizations]) @@ -13,7 +15,7 @@ [Define to 1 if you want to use SSE3 optimizations]) # put compiler specific flags here if test x_$ac_cv_c_compiler_gnu = x_yes ; then - CFLAGS="-march=prescott -msse3 -mfpmath=sse ${CFLAGS}" + OPT_CFLAGS="-msse3 ${OPT_CFLAGS}" fi fi @@ -27,7 +29,7 @@ [Define to 1 if you want to use SSE2 optimizations]) # put compiler specific flags here if test x_$ac_cv_c_compiler_gnu = x_yes ; then - CFLAGS="-march=pentium4 -msse2 -mfpmath=sse ${CFLAGS}" + OPT_CFLAGS="-msse2 ${OPT_CFLAGS}" fi fi @@ -41,7 +43,7 @@ [Define to 1 if you want to use SSE optimizations]) # put compiler specific flags here if test x_$ac_cv_c_compiler_gnu = x_yes ; then - CFLAGS="-march=pentium3 -msse -mfpmath=sse ${CFLAGS}" + OPT_CFLAGS="-msse ${OPT_CFLAGS}" fi fi @@ -55,7 +57,7 @@ [Define to 1 if you want to use MMX optimizations]) # put compiler specific flags here if test x_$ac_cv_c_compiler_gnu = x_yes ; then - CFLAGS="-march=pentium2 -mmmx -mfpmath=387 ${CFLAGS}" + OPT_CFLAGS="-mmmx ${OPT_CFLAGS}" fi fi @@ -70,10 +72,16 @@ [Define to 1 if you want to use 3D-Now optimizations]) # put compiler specific flags here if test x_$ac_cv_c_compiler_gnu = x_yes ; then - CFLAGS="-march=pentium2 -m3dnow -mfpmath=387 ${CFLAGS}" + OPT_CFLAGS="-m3dnow ${OPT_CFLAGS}" fi fi +if test x_$enable_sse = x_yes || test x_$enable_sse2 = x_yes || test x_$enable_sse3 = x_yes ; then + OPT_CFLAGS="${OPT_CFLAGS} -mfpmath=sse" +elif test x_$enable_mmx = x_yes || test x_$enable_3dnow = x_yes ; then + OPT_CFLAGS="${OPT_CFLAGS} -mfpmath=386" +fi + AC_ARG_ENABLE([fast-math], AC_HELP_STRING([--enable-fast-math], [Use gcc -ffast-math optimization]) @@ -84,7 +92,7 @@ [Define to 1 if you want to use the gcc -ffast-math optimization]) # put compiler specific flags here if test x_$ac_cv_c_compiler_gnu = x_yes ; then - CFLAGS="${CFLAGS} -ffast-math" + OPT_CFLAGS="${OPT_CFLAGS} -ffast-math" fi fi @@ -98,13 +106,14 @@ [Define to 1 if you want to use ALTIVEC optimizations]) # put compiler specific flags here if test x_$ac_cv_c_compiler_gnu = x_yes ; then - SAH_CHECK_CFLAG([-faltivec],[CFLAGS="-faltivec ${CFLAGS}"]) - SAH_CHECK_CFLAG([-maltivec],[CFLAGS="-maltivec ${CFLAGS}"]) - SAH_CHECK_CFLAG([-mtune=G5],[CFLAGS="-mtune=G5 ${CFLAGS}"]) - SAH_CHECK_CFLAG([-mcpu=powerpc],[CFLAGS="-mcpu=powerpc ${CFLAGS}"]) - SAH_CHECK_LDFLAG([-framework Accelerate],[LDFLAGS="${LDFLAGS} -framework Accelerate"]) + SAH_CHECK_CFLAG([-faltivec],[OPT_CFLAGS="-faltivec ${OPT_CFLAGS}"]) + SAH_CHECK_CFLAG([-maltivec],[OPT_CFLAGS="-maltivec ${OPT_CFLAGS}"]) + SAH_CHECK_LDFLAG([-framework Accelerate],[OPT_LDFLAGS="${OPT_LDFLAGS} -framework Accelerate"]) fi fi +AC_SUBST([OPT_CFLAGS]) +AC_SUBST([OPT_LDFLAGS]) + fi ])