aboutsummaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2012-09-20 15:50:14 +0100
committerMans Rullgard <mans@mansr.com>2012-10-04 18:21:49 +0100
commit65d12900432ac880d764edbbd36818431484a76e (patch)
tree2f91bc8cd0fb57e2e39e43cad8161ac1c9d531f3 /configure
parent54b243141e9ded3437f055d173272caa399a216e (diff)
downloadffmpeg-65d12900432ac880d764edbbd36818431484a76e.tar.gz
configure: add --enable-lto option
This works with gcc. Other compilers might need to have a flag mapping added. Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure38
1 files changed, 27 insertions, 11 deletions
diff --git a/configure b/configure
index d09684c7b0..4c3ebdb281 100755
--- a/configure
+++ b/configure
@@ -238,6 +238,7 @@ Advanced options (experts only):
disable buffer boundary checking in bitreaders
(faster, but may crash)
--enable-memalign-hack emulate memalign, interferes with memory debuggers
+ --enable-lto use link-time optimization
Optimization options (experts only):
--disable-asm disable all assembler optimizations
@@ -1290,6 +1291,7 @@ CMDLINE_SELECT="
debug
extra_warnings
logging
+ lto
optimizations
"
@@ -3445,17 +3447,31 @@ void ff_foo(void) {}
EOF
fi
-if [ -n "$optflags" ]; then
- add_cflags $optflags
-elif enabled small; then
- add_cflags $cflags_size
-elif enabled optimizations; then
- add_cflags $cflags_speed
-else
- add_cflags $cflags_noopt
+if [ -z "$optflags" ]; then
+ if enabled small; then
+ optflags=$cflags_size
+ elif enabled optimizations; then
+ optflags=$cflags_speed
+ else
+ optflags=$cflags_noopt
+ fi
fi
-check_cflags -fno-math-errno
-check_cflags -fno-signed-zeros
+
+check_optflags(){
+ check_cflags "$@"
+ enabled lto && check_ldflags "$@"
+}
+
+
+if enabled lto; then
+ test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
+ check_cflags -flto
+ check_ldflags -flto $cpuflags
+fi
+
+check_optflags $optflags
+check_optflags -fno-math-errno
+check_optflags -fno-signed-zeros
if enabled icc; then
# Just warnings, no remarks
@@ -3490,7 +3506,7 @@ elif enabled ccc; then
add_cflags -msg_disable ptrmismatch1
add_cflags -msg_disable unreachcode
elif enabled gcc; then
- check_cflags -fno-tree-vectorize
+ check_optflags -fno-tree-vectorize
check_cflags -Werror=implicit-function-declaration
check_cflags -Werror=missing-prototypes
check_cflags -Werror=declaration-after-statement