summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/Makefile.am1
-rw-r--r--m4/_xine.m430
-rw-r--r--m4/attributes.m418
-rw-r--r--m4/optimizations.m4261
4 files changed, 18 insertions, 292 deletions
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 242fff4d3..90067a942 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -25,7 +25,6 @@ EXTRA_DIST = \
macosx.m4 \
objc.m4 \
opengl.m4 \
- optimizations.m4 \
pkg.m4 \
pthreads.m4 \
symbol.m4 \
diff --git a/m4/_xine.m4 b/m4/_xine.m4
index 930703bbb..92e372fcb 100644
--- a/m4/_xine.m4
+++ b/m4/_xine.m4
@@ -142,36 +142,6 @@ AC_DEFUN([AC_CHECK_DXR3],
fi
])
-dnl AC_TRY_CFLAGS (CFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS])
-dnl check if $CC supports a given set of cflags
-AC_DEFUN([AC_TRY_CFLAGS],
- [AC_MSG_CHECKING([if $CC supports $1 flags])
- SAVE_CFLAGS="$CFLAGS"
- CFLAGS="$1"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[ac_cv_try_cflags_ok=yes],[ac_cv_try_cflags_ok=no])
- CFLAGS="$SAVE_CFLAGS"
- AC_MSG_RESULT([$ac_cv_try_cflags_ok])
- if test x"$ac_cv_try_cflags_ok" = x"yes"; then
- ifelse([$2],[],[:],[$2])
- else
- ifelse([$3],[],[:],[$3])
- fi])
-
-dnl AC_TRY_LDFLAGS (CFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS])
-dnl check if $CC supports a given set of ldflags
-AC_DEFUN([AC_TRY_LDFLAGS],
- [AC_MSG_CHECKING([if $CC supports $1 flags])
- SAVE_LDFLAGS="$LDFLAGS"
- LDFLAGS="$1"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[ac_cv_try_ldflags_ok=yes],[ac_cv_try_ldflags_ok=no])
- LDFLAGS="$SAVE_LDFLAGS"
- AC_MSG_RESULT([$ac_cv_try_ldflags_ok])
- if test x"$ac_cv_try_ldflags_ok" = x"yes"; then
- ifelse([$2],[],[:],[$2])
- else
- ifelse([$3],[],[:],[$3])
- fi])
-
dnl AC_CHECK_GENERATE_INTTYPES_H (INCLUDE-DIRECTORY)
dnl generate a default inttypes.h if the header file does not exist already
AC_DEFUN([AC_CHECK_GENERATE_INTTYPES],
diff --git a/m4/attributes.m4 b/m4/attributes.m4
index 23b5f2ee4..f781429f7 100644
--- a/m4/attributes.m4
+++ b/m4/attributes.m4
@@ -50,6 +50,24 @@ AC_DEFUN([CC_CHECK_CFLAGS], [
fi
])
+AC_DEFUN([CC_CHECK_LDFLAGS], [
+ AC_CACHE_CHECK([if $CC supports $1 flag],
+ AS_TR_SH([cc_cv_ldflags_$1]),
+ [ac_save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $1"
+ AC_LINK_IFELSE([int a;],
+ [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
+ [eval "AS_TR_SH([cc_cv_ldflags_$1])="])
+ LDFLAGS="$ac_save_LDFLAGS"
+ ])
+
+ if eval test [x$]AS_TR_SH([cc_cv_ldflags_$1]) = xyes; then
+ ifelse([$2], , [:], [$2])
+ else
+ ifelse([$3], , [:], [$3])
+ fi
+])
+
dnl Check for a -Werror flag or equivalent. -Werror is the GCC
dnl and ICC flag that tells the compiler to treat all the warnings
dnl as fatal. We usually need this option to make sure that some
diff --git a/m4/optimizations.m4 b/m4/optimizations.m4
deleted file mode 100644
index f25da2a02..000000000
--- a/m4/optimizations.m4
+++ /dev/null
@@ -1,261 +0,0 @@
-dnl
-dnl M4 macro to add support for extra optimizations
-dnl
-dnl It understand --enable/--disable-optimizations .
-dnl when optimizations are disabled, it does not touch cflags
-dnl
-dnl Note: always disable while crosscompiling
-dnl
-
-AC_DEFUN([AC_OPTIMIZATIONS], [
- dnl By default, enable optimizations only if --enable-debug is not specified
- AC_ARG_ENABLE([optimizations],
- AS_HELP_STRING([--disable-optimizations], [Don't try to guess what optimization to enable]),
- [], [test x"$enable_debug" != x"no" && enable_optimizations="no"])
-
- if test "x$enable_optimizations" != "xno"; then
- INLINE_FUNCTIONS=-finline-functions
-
- if test "$GCC" = yes; then
- dnl
- dnl check cflags not supported by all gcc versions
- AC_TRY_CFLAGS("-fschedule-insns2", f_si="-fschedule-insns2", f_si="")
- AC_TRY_CFLAGS("-mwide-multiply", m_wm="-mwide-multiply", m_wm="")
- dnl
- dnl gcc 3.1 uses the -f version
- dnl
- AC_TRY_CFLAGS("-falign-functions=4", f_af="-falign-functions=4",
- f_af="-malign-functions=4")
- AC_TRY_CFLAGS("-falign-loops=4", f_al="-falign-loops=4",
- f_al="-malign-loops=4")
- AC_TRY_CFLAGS("-falign-jumps=4", f_aj="-falign-jumps=4",
- f_aj="-malign-jumps=4")
- dnl
- dnl Check for some optimization disabling
- dnl needed for win32 code
- dnl
- AC_TRY_CFLAGS("-fno-omit-frame-pointer", W32_NO_OPTIMIZE="$W32_NO_OPTIMIZE -fno-omit-frame-pointer",)
- AC_TRY_CFLAGS("-fno-inline-functions", W32_NO_OPTIMIZE="$W32_NO_OPTIMIZE -fno-inline-functions",)
- AC_TRY_CFLAGS("-fno-rename-registers", W32_NO_OPTIMIZE="$W32_NO_OPTIMIZE -fno-rename-registers",)
- AC_SUBST(W32_NO_OPTIMIZE)
- dnl
- dnl Multipass compilation
- dnl
- AC_TRY_CFLAGS("-fprofile-arcs", PASS1_CFLAGS="-fprofile_arcs $PASS1_CFLAGS",)
- AC_TRY_CFLAGS("-fbranch-probabilities", PASS2_CFLAGS="-fbranch-probabilities $PASS2_CFLAGS",)
- AC_SUBST(PASS1_CFLAGS)
- AC_SUBST(PASS2_CFLAGS)
- dnl
- dnl Warnings
- dnl
- CFLAGS="-Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes $CFLAGS"
- CFLAGS="-Wnested-externs -Wcast-align $CFLAGS"
- dnl some combinations of gcc+glibc produce useless warnings on memset
- dnl when compiling with -Wpointer-arith, so we check for this first
- AC_MSG_CHECKING(for sane -Wpointer-arith)
- SAVE_CFLAGS="$CFLAGS"
- CFLAGS="-O2 -Wpointer-arith -Werror $CFLAGS"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>]], [[int a; memset(&a, 0, sizeof(int));]])],
- [AC_MSG_RESULT(yes); CFLAGS="-Wpointer-arith $SAVE_CFLAGS"],
- [AC_MSG_RESULT(no); CFLAGS="$SAVE_CFLAGS"]);
-
- dnl gcc 3.3.5 (at least) is known to be buggy wrt optimisation and
- dnl -finline-functions. Use -fno-inline-functions for gcc < 3.4.0.
-
- AC_MSG_CHECKING(for gcc 3.4.0 or later)
- newGCC="`"$CC" -dumpversion |
- awk -F. '{ if ((@S|@1 * 10000 + @S|@2 * 100 + @S|@3) >= 30400) { print "yes" } }'
- `"
- AC_MSG_RESULT(${newGCC:-no - assuming bugginess in -finline-functions})
- test "$newGCC" = yes || INLINE_FUNCTIONS=-fno-inline-functions
- fi
-
- dnl Flags not supported by all *cc* variants
- AC_TRY_CFLAGS("-Wall", wall="-Wall", wall="")
-
- CFLAGS="$wall ${CFLAGS}"
- DEBUG_CFLAGS="$wall ${DEBUG_CFLAGS}"
-
- if test "$enable_macosx_universal"; then
- optimize_for_host="universal-darwin"
- else
- optimize_for_host="$host_or_hostalias"
- fi
-
- case "$optimize_for_host" in
- i?86-* | k?-* | athlon-* | pentium*)
- if test "$GCC" = yes -o "${CC##*/}x" = "iccx" ; then
-
- if test "$GCC" = yes; then
- dnl Check for gcc cpu optimization support
- AC_TRY_CFLAGS("-mtune=i386",
- sarchopt="-mtune",
- AC_TRY_CFLAGS("-mcpu=i386",
- sarchopt="-mcpu",
- AC_TRY_CFLAGS("-march=i386",
- sarchopt="-march",
- [ AC_MSG_RESULT(** no cpu optimization supports **)
- sarchopt=no
- ]
- )
- )
- )
-
- dnl special check for k7 cpu CC support
- AC_TRY_CFLAGS("$sarchopt=athlon", k7cpu="athlon", k7cpu="i686")
-
- dnl add x86 specific gcc CFLAGS
- CFLAGS="-O3 -pipe -fomit-frame-pointer $f_af $f_al $f_aj $m_wm $m_psb -fexpensive-optimizations $f_si -ffast-math $INLINE_FUNCTIONS $CFLAGS"
-
- DEBUG_CFLAGS="-O $DEBUG_CFLAGS"
-
- if test x"$sarchopt" != "xno"; then
- archopt_val=
-
- case "$host_or_hostalias" in
- i386-*)
- archopt_val="i386" ;;
- i486-*)
- archopt_val="i486" ;;
- i586-*)
- archopt_val="pentium"
- ;;
- pentium-mmx-*)
- archopt_val="pentium-mmx"
- ;;
- pentiumpro-* | pentium2-* | i686-*)
- archopt_val="pentiumpro"
- if test x"$host" = x"$build"; then
- if test -f /proc/cpuinfo; then
- modelname=`cat /proc/cpuinfo | grep "model\ name\ :" | sed -e 's/ //g' | cut -d':' -f2`
- case "$modelname" in
- *Athlon* | *Duron* | *K7*)
- archopt_val="$k7cpu"
- ;;
- VIAEzra)
- archopt_val="c3"
- ;;
- esac
- fi
- fi
- ;;
- k6-2-* | k6-3-*)
- archopt_val="k6-2"
- ;;
- k6-*)
- archopt_val="k6"
- ;;
- pentium3-*)
- archopt_val="pentium3"
- ;;
- pentium4-*)
- archopt_val="pentium4"
- ;;
- athlon-4-* | athlon-xp-* | athlon-mp-*)
- archopt_val="athlon-4"
- ;;
- k7-* | athlon-tbird-* | athlon-*)
- archopt_val="athlon"
- ;;
-
- esac
- if test x"$archopt_val" != x; then
- CFLAGS="$sarchopt=$archopt_val $CFLAGS"
- DEBUG_CFLAGS="$sarchopt=$archopt_val $DEBUG_CFLAGS"
- fi
- fi
- else
- dnl we have the Intel compiler
- CFLAGS="-unroll -ipo -ipo_obj -O3 $CFLAGS"
- PASS1_CFLAGS="-prof_genx -prof_dir \$(PWD)/\$(top_builddir)/ $PASS1_CFLAGS"
- PASS2_CFLAGS="-prof_use -prof_dir \$(PWD)/\$(top_builddir)/ $PASS2_CFLAGS"
- AC_SUBST(PASS1_CFLAGS)
- AC_SUBST(PASS2_CFLAGS)
- fi
-
- else
- dnl add x86 specific cc CFLAGS
- CFLAGS="-O $CFLAGS"
- DEBUG_CFLAGS="-O $DEBUG_CFLAGS"
- AC_DEFINE_UNQUOTED(FPM_64BIT,,[Define to select libmad fixed point arithmetic implementation])
- fi
- ;;
- alphaev56-*)
- CFLAGS="-O3 -mcpu=ev56 -mieee $CFLAGS"
- DEBUG_CFLAGS="-O3 -mcpu=ev56 -mieee $DEBUG_CFLAGS"
- ;;
- alpha*)
- CFLAGS="-O3 -mieee $CFLAGS"
- DEBUG_CFLAGS="-O3 -mieee $DEBUG_CFLAGS"
- ;;
- *darwin*)
- CFLAGS="-O3 -pipe -fomit-frame-pointer $m_wm $m_psb -fexpensive-optimizations $f_si -ffast-math $INLINE_FUNCTIONS -no-cpp-precomp -D_INTL_REDIRECT_MACROS $CFLAGS"
- OBJCFLAGS="-O3 -pipe -fomit-frame-pointer $m_wm $m_psb -fexpensive-optimizations $f_si -ffast-math $INLINE_FUNCTIONS -no-cpp-precomp -D_INTL_REDIRECT_MACROS $CFLAGS"
- DEBUG_CFLAGS="-O3 $DEBUG_CFLAGS"
- ;;
- ppc-*-linux* | powerpc-*)
- CFLAGS="-O3 -pipe -fomit-frame-pointer $m_wm $m_psb -fexpensive-optimizations $f_si -ffast-math $INLINE_FUNCTIONS $CFLAGS"
- DEBUG_CFLAGS="-O3 $DEBUG_CFLAGS"
- ;;
- sparc*-*-linux*)
- CFLAGS="-O3 $cpu_cflags $INLINE_FUNCTIONS $CFLAGS"
- DEBUG_CFLAGS="-O $cpu_cflags $INLINE_FUNCTIONS $DEBUG_CFLAGS"
-
- case `uname -m` in
- sparc)
- cpu_cflags="-mcpu=supersparc -mtune=supersparc" ;;
- sparc64)
- cpu_cflags="-mcpu=ultrasparc -mtune=ultrasparc" ;;
- esac
- ;;
- sparc-*-solaris*)
- if test "$GCC" = yes; then
- case `uname -m` in
- sun4c) cpu_cflags="-mcpu=v7 -mtune=supersparc" ;;
- sun4m) cpu_cflags="-mcpu=v8 -mtune=supersparc" ;;
- sun4u)
- case `$CC --version 2>/dev/null` in
- 1.*|2.*)
- # -mcpu=ultrasparc triggers a GCC 2.95.x compiler bug when
- # compiling video_out.c:
- # gcc: Internal compiler error: program cc1 got fatal signal 11
- # avoid -mcpu=ultrasparc with gcc 2.*
- cpu_cflags="-mcpu=v8 -mtune=ultrasparc"
- ;;
- *)
- # GCC 3 or newer should have no problem with -mcpu=ultrasparc
- cpu_cflags="-mcpu=ultrasparc -mtune=ultrasparc"
- ;;
- esac
- ;;
- esac
- cc_optimize_cflags="-O3 $cpu_cflags $INLINE_FUNCTIONS"
- cc_debug_cflags="-O $cpu_cflags $INLINE_FUNCTIONS"
- else
- case `uname -m` in
- sun4c) cpu_cflags="-xarch=v7" ;;
- sun4m) cpu_cflags="-xarch=v8" ;;
- sun4u) cpu_cflags="-xarch=v8plusa" ;;
- esac
- cc_optimize_cflags="-fast $cpu_cflags -xCC"
- cc_debug_cflags="-O"
- fi
-
- CFLAGS="$cc_optimize_cflags $CFLAGS"
- DEBUG_CFLAGS="$cc_debug_cflags $DEBUG_CFLAGS"
- ;;
- x86_64-*)
- CFLAGS="-O3 -fomit-frame-pointer $m_wm $m_psb -fexpensive-optimizations $f_si -ffast-math $INLINE_FUNCTIONS $CFLAGS"
- DEBUG_CFLAGS="-g $DEBUG_CFLAGS"
- ;;
- armv4l-*-linux*)
- CFLAGS="-O2 -fsigned-char -ffast-math -mcpu=strongarm1100 -fomit-frame-pointer -fthread-jumps -fregmove $CFLAGS"
- dnl CFLAGS="-O1 -fforce-mem -fforce-addr -fthread-jumps -fcse-follow-jumps -fcse-skip-blocks -fexpensive-optimizations -fregmove -fschedule-insns2 $INLINE_FUNCTIONS -fsigned-char -fomit-frame-pointer -march=armv4 -mtune=strongarm $CFLAGS"
- DEBUG_CFLAGS="-O2 $DEBUG_CFLAGS"
- ;;
- esac
- fi
-])
-
-dnl Kate modeline: leave at the end
-dnl kate: indent-width 2; replace-trailing-space-save 1; space-indent 1; backspace-indents 1;