configure: Add check_cc/require_cc helper functions to simplify some expressions
This commit is contained in:
parent
83fef16b6a
commit
9c37d765ef
65
configure
vendored
65
configure
vendored
@ -1129,6 +1129,14 @@ check_compile_assert(){
|
|||||||
test_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name"
|
test_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_cc(){
|
||||||
|
log check_cc "$@"
|
||||||
|
name=$1
|
||||||
|
shift
|
||||||
|
disable "$name"
|
||||||
|
test_code cc "$@" && enable "$name"
|
||||||
|
}
|
||||||
|
|
||||||
require(){
|
require(){
|
||||||
log require "$@"
|
log require "$@"
|
||||||
name_version="$1"
|
name_version="$1"
|
||||||
@ -1137,6 +1145,13 @@ require(){
|
|||||||
check_lib $name "$@" || die "ERROR: $name_version not found"
|
check_lib $name "$@" || die "ERROR: $name_version not found"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_cc(){
|
||||||
|
log require_cc "$@"
|
||||||
|
name="$1"
|
||||||
|
shift
|
||||||
|
test_code cc "$@" || die "ERROR: $name failed"
|
||||||
|
}
|
||||||
|
|
||||||
require_header(){
|
require_header(){
|
||||||
log require_header "$@"
|
log require_header "$@"
|
||||||
headers="$1"
|
headers="$1"
|
||||||
@ -4172,18 +4187,12 @@ extern_prefix=${sym%%ff_extern*}
|
|||||||
! disabled inline_asm && check_inline_asm inline_asm '"" ::'
|
! disabled inline_asm && check_inline_asm inline_asm '"" ::'
|
||||||
|
|
||||||
for restrict_keyword in restrict __restrict__ __restrict ""; do
|
for restrict_keyword in restrict __restrict__ __restrict ""; do
|
||||||
test_cc <<EOF && break
|
test_code cc "" "char * $restrict_keyword p" && break
|
||||||
void foo(char * $restrict_keyword p);
|
|
||||||
EOF
|
|
||||||
done
|
done
|
||||||
|
|
||||||
test_cc <<EOF && enable pragma_deprecated
|
check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
|
||||||
void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
|
|
||||||
EOF
|
|
||||||
|
|
||||||
test_cc <<EOF || die "endian test failed"
|
require_cc "endian test" "" "unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'"
|
||||||
unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
|
|
||||||
EOF
|
|
||||||
od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
|
od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
|
||||||
|
|
||||||
check_gas() {
|
check_gas() {
|
||||||
@ -4334,19 +4343,17 @@ elif enabled ppc; then
|
|||||||
check_cflags -maltivec -mabi=altivec
|
check_cflags -maltivec -mabi=altivec
|
||||||
|
|
||||||
# check if our compiler supports Motorola AltiVec C API
|
# check if our compiler supports Motorola AltiVec C API
|
||||||
test_code cc altivec.h "vector signed int v1 = (vector signed int) { 0 };
|
check_cc altivec altivec.h "vector signed int v1 = (vector signed int) { 0 };
|
||||||
vector signed int v2 = (vector signed int) { 1 };
|
vector signed int v2 = (vector signed int) { 1 };
|
||||||
v1 = vec_add(v1, v2);" ||
|
v1 = vec_add(v1, v2);"
|
||||||
disable altivec
|
|
||||||
|
|
||||||
enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
|
enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if enabled vsx; then
|
if enabled vsx; then
|
||||||
check_cflags -mvsx &&
|
check_cflags -mvsx &&
|
||||||
test_code cc altivec.h "int v[4] = { 0 };
|
check_cc vsx altivec.h "int v[4] = { 0 };
|
||||||
vector signed int v1 = vec_vsx_ld(0, v);" ||
|
vector signed int v1 = vec_vsx_ld(0, v);"
|
||||||
disable vsx
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if enabled power8; then
|
if enabled power8; then
|
||||||
@ -4427,7 +4434,7 @@ EOF
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_neon
|
check_cc intrinsics_neon arm_neon.h "int16x8_t test = vdupq_n_s16(0)"
|
||||||
|
|
||||||
check_ldflags -Wl,--as-needed
|
check_ldflags -Wl,--as-needed
|
||||||
|
|
||||||
@ -4761,15 +4768,11 @@ EOF
|
|||||||
|
|
||||||
enabled vaapi && require vaapi va/va.h vaInitialize -lva
|
enabled vaapi && require vaapi va/va.h vaInitialize -lva
|
||||||
|
|
||||||
enabled vaapi &&
|
if enabled vaapi; then
|
||||||
test_code cc "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" ||
|
require_cc vaapi "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)"
|
||||||
disable vaapi
|
|
||||||
|
|
||||||
enabled vaapi &&
|
|
||||||
check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm
|
check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm
|
||||||
|
|
||||||
enabled vaapi &&
|
|
||||||
check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11
|
check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11
|
||||||
|
fi
|
||||||
|
|
||||||
enabled vaapi &&
|
enabled vaapi &&
|
||||||
test_cpp_condition "va/va.h" "VA_CHECK_VERSION(1, 0, 0)" &&
|
test_cpp_condition "va/va.h" "VA_CHECK_VERSION(1, 0, 0)" &&
|
||||||
@ -4821,9 +4824,7 @@ check_disable_warning_headers -Wno-unused-variable
|
|||||||
|
|
||||||
check_objcflags -fobjc-arc && enable objc_arc
|
check_objcflags -fobjc-arc && enable objc_arc
|
||||||
|
|
||||||
test_cc <<EOF && enable blocks_extension
|
check_cc blocks_extension "" "void (^block)(void)"
|
||||||
void (^block)(void);
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# add some linker flags
|
# add some linker flags
|
||||||
check_ldflags -Wl,--warn-common
|
check_ldflags -Wl,--warn-common
|
||||||
@ -4877,14 +4878,10 @@ if enabled proper_dce; then
|
|||||||
if test_ldflags -Wl,${version_script},$TMPV; then
|
if test_ldflags -Wl,${version_script},$TMPV; then
|
||||||
append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
|
append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
|
||||||
quotes='""'
|
quotes='""'
|
||||||
test_cc <<EOF && enable symver_asm_label
|
check_cc symver_asm_label "" "void ff_foo(void) __asm__ ("av_foo@VERSION");
|
||||||
void ff_foo(void) __asm__ ("av_foo@VERSION");
|
void ff_foo(void) { ${inline_asm+__asm__($quotes);} }"
|
||||||
void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
|
check_cc symver_gnu_asm "" "__asm__(".symver ff_foo,av_foo@VERSION");
|
||||||
EOF
|
void ff_foo(void) {}"
|
||||||
test_cc <<EOF && enable symver_gnu_asm
|
|
||||||
__asm__(".symver ff_foo,av_foo@VERSION");
|
|
||||||
void ff_foo(void) {}
|
|
||||||
EOF
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user