1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

Merge commit '9f57f134c19773d54269b6cb9ee455ff87c2e9e1'

* commit '9f57f134c19773d54269b6cb9ee455ff87c2e9e1':
  configure: ObjC support

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
This commit is contained in:
Hendrik Leppkes 2015-12-05 11:49:44 +01:00
commit 3b0f63e110
2 changed files with 50 additions and 11 deletions

View File

@ -18,7 +18,7 @@ ifndef SUBDIR
ifndef V
Q = @
ECHO = printf "$(1)\t%s\n" $(2)
BRIEF = CC CXX HOSTCC HOSTLD AS YASM AR LD STRIP CP WINDRES
BRIEF = CC CXX OBJCC HOSTCC HOSTLD AS YASM AR LD STRIP CP WINDRES
SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM
MSG = $@
@ -36,6 +36,8 @@ IFLAGS := -I. -I$(SRC_PATH)/
CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
CFLAGS += $(ECFLAGS)
CCFLAGS = $(CPPFLAGS) $(CFLAGS)
OBJCFLAGS += $(EOBJCFLAGS)
OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS)
ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
CXXFLAGS += $(CPPFLAGS) $(CFLAGS)
YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm
@ -51,6 +53,7 @@ endef
COMPILE_C = $(call COMPILE,CC)
COMPILE_CXX = $(call COMPILE,CXX)
COMPILE_S = $(call COMPILE,AS)
COMPILE_M = $(call COMPILE,OBJCC)
COMPILE_HOSTC = $(call COMPILE,HOSTCC)
%.o: %.c
@ -60,7 +63,7 @@ COMPILE_HOSTC = $(call COMPILE,HOSTCC)
$(COMPILE_CXX)
%.o: %.m
$(COMPILE_C)
$(COMPILE_M)
%.s: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) -S -o $@ $<

54
configure vendored
View File

@ -316,6 +316,7 @@ Toolchain options:
--yasmexe=EXE use yasm-compatible assembler EXE [$yasmexe_default]
--cc=CC use C compiler CC [$cc_default]
--cxx=CXX use C compiler CXX [$cxx_default]
--objcc=OCC use ObjC compiler OCC [$cc_default]
--dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
--ld=LD use linker LD [$ld_default]
--pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default]
@ -331,6 +332,7 @@ Toolchain options:
--host-os=OS compiler host OS [$target_os]
--extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
--extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
--extra-objcflags=FLAGS add FLAGS to OBJCFLAGS [$CFLAGS]
--extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
--extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]
--extra-ldlibflags=ELDFLAGS add ELDFLAGS to LDLIBFLAGS [$LDLIBFLAGS]
@ -805,6 +807,10 @@ add_asflags(){
append ASFLAGS $($asflags_filter "$@")
}
add_objcflags(){
append OBJCFLAGS $($objcflags_filter "$@")
}
add_ldflags(){
append LDFLAGS $($ldflags_filter "$@")
}
@ -875,11 +881,11 @@ check_cxx(){
check_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" $CXX_C -o $TMPO $TMPCPP
}
check_oc(){
log check_oc "$@"
check_objcc(){
log check_objcc "$@"
cat > $TMPM
log_file $TMPM
check_cmd $cc -Werror=missing-prototypes $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPM
check_cmd $objcc -Werror=missing-prototypes $CPPFLAGS $CFLAGS $OBJCFLAGS "$@" $OBJCC_C $(cc_o $TMPO) $TMPM
}
check_cpp(){
@ -990,6 +996,19 @@ int x;
EOF
}
test_objcflags(){
log test_cflags "$@"
set -- $($cflags_filter "$@")
check_objcc "$@" <<EOF
int x;
EOF
}
check_objcflags(){
log check_cflags "$@"
test_objcflags "$@" && add_objcflags "$@"
}
test_ldflags(){
log test_ldflags "$@"
check_ld "cc" "$@" <<EOF
@ -1027,8 +1046,8 @@ int x;
EOF
}
check_header_oc(){
log check_header_oc "$@"
check_header_objcc(){
log check_header_objcc "$@"
rm -f -- "$TMPO"
header=$1
shift
@ -1036,7 +1055,7 @@ check_header_oc(){
{
echo "#include <$header>"
echo "int main(void) { return 0; }"
} | check_oc && check_stat "$TMPO" && enable_safe $headers
} | check_objcc && check_stat "$TMPO" && enable_safe $headers
}
check_func(){
@ -2061,6 +2080,7 @@ CMDLINE_SET="
assert_level
build_suffix
cc
objcc
cpu
cross_prefix
custom_allocator
@ -2105,6 +2125,7 @@ CMDLINE_SET="
CMDLINE_APPEND="
extra_cflags
extra_cxxflags
extra_objcflags
host_cppflags
"
@ -3026,6 +3047,9 @@ CC_E='-E -o $@'
CC_O='-o $@'
CXX_C='-c'
CXX_O='-o $@'
OBJCC_C='-c'
OBJCC_E='-E -o $@'
OBJCC_O='-o $@'
LD_O='-o $@'
LD_LIB='-l%'
LD_PATH='-L'
@ -3850,16 +3874,22 @@ test -n "$cc_type" && enable $cc_type ||
warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
: ${as_default:=$cc}
: ${objcc_default:=$cc}
: ${dep_cc_default:=$cc}
: ${ld_default:=$cc}
: ${host_ld_default:=$host_cc}
set_default ar as dep_cc ld host_ld windres
set_default ar as objcc dep_cc ld host_ld windres
probe_cc as "$as"
asflags_filter=$_flags_filter
add_asflags $_flags $_cflags
set_ccvars AS
probe_cc objcc "$objcc"
objcflags_filter=$_flags_filter
add_objcflags $_flags $_cflags
set_ccvars OBJC
probe_cc ld "$ld"
ldflags_filter=$_flags_filter
add_ldflags $_flags $_ldflags
@ -3899,6 +3929,7 @@ fi
add_cflags $extra_cflags
add_cxxflags $extra_cxxflags
add_objcflags $extra_objcflags
add_asflags $extra_cflags
if test -n "$sysroot"; then
@ -5335,7 +5366,7 @@ for func in $COMPLEX_FUNCS; do
done
# these are off by default, so fail if requested and not available
enabled avfoundation_indev && { check_header_oc AVFoundation/AVFoundation.h || disable avfoundation_indev; }
enabled avfoundation_indev && { check_header_objcc AVFoundation/AVFoundation.h || disable avfoundation_indev; }
enabled avfoundation_indev && { check_lib2 CoreGraphics/CoreGraphics.h CGGetActiveDisplayList -framework CoreGraphics ||
check_lib2 ApplicationServices/ApplicationServices.h CGGetActiveDisplayList -framework ApplicationServices; }
enabled avisynth && { { check_lib2 "windows.h" LoadLibrary; } ||
@ -5491,7 +5522,7 @@ enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -l
check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; }
enabled qtkit_indev && { check_header_oc QTKit/QTKit.h || disable qtkit_indev; }
enabled qtkit_indev && { check_header_objcc QTKit/QTKit.h || disable qtkit_indev; }
# libdc1394 check
if enabled libdc1394; then
@ -6154,6 +6185,7 @@ INTRINSICS=$intrinsics
CC=$cc
CXX=$cxx
AS=$as
OBJCC=$objcc
LD=$ld
DEPCC=$dep_cc
DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
@ -6171,9 +6203,13 @@ LN_S=$ln_s
CPPFLAGS=$CPPFLAGS
CFLAGS=$CFLAGS
CXXFLAGS=$CXXFLAGS
OBJCFLAGS=$OBJCFLAGS
ASFLAGS=$ASFLAGS
AS_C=$AS_C
AS_O=$AS_O
OBJCC_C=$OBJCC_C
OBJCC_E=$OBJCC_E
OBJCC_O=$OBJCC_O
CC_C=$CC_C
CC_E=$CC_E
CC_O=$CC_O