[FFmpeg-devel] [PATCHv2] configure: correct check_mathfunc

Ganesh Ajjanagadde gajjanagadde at gmail.com
Thu Dec 24 21:00:36 CET 2015


check_mathfunc should test the existence of a prototype, and not
implementation.
It also needs to be moved past the pkgconfig stage, in order to ensure
that all cflags, cppflags have been defined.

This fixes detection of exp10, exp10f.

Reviewed-by: Nicolas George <george at nsup.org>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 configure | 65 ++++++++++++++++++++++++++++++++++++---------------------------
 1 file changed, 37 insertions(+), 28 deletions(-)

diff --git a/configure b/configure
index ba77221..ffe827f 100755
--- a/configure
+++ b/configure
@@ -1072,29 +1072,36 @@ EOF
 check_complexfunc(){
     log check_complexfunc "$@"
     func=$1
-    narg=$2
-    shift 2
-    test $narg = 2 && args="f, g" || args="f * I"
+    shift 1
     disable $func
-    check_ld "cc" "$@" <<EOF && enable $func
+    check_cc "$@" <<EOF && enable $func
 #include <complex.h>
 #include <math.h>
-float foo(complex float f, complex float g) { return $func($args); }
-int main(void){ return (int) foo; }
+int main(void){ return (int) $func; }
 EOF
 }
 
 check_mathfunc(){
     log check_mathfunc "$@"
     func=$1
-    narg=$2
-    shift 2
-    test $narg = 2 && args="f, g" || args="f"
+    shift 1
     disable $func
-    check_ld "cc" "$@" <<EOF && enable $func
+    check_cc "$@" <<EOF && enable $func
 #include <math.h>
-float foo(float f, float g) { return $func($args); }
-int main(void){ return (int) foo; }
+int main(void){ return (int) $func; }
+EOF
+}
+
+check_mathmacro(){
+    log check_mathfunc "$@"
+    macro=$1
+    shift 1
+    disable $macro
+    check_cc "$@" <<EOF && enable $macro
+#include <math.h>
+#if !defined($macro)
+#error "macro not present: $macro"
+#endif
 EOF
 }
 
@@ -1807,6 +1814,11 @@ COMPLEX_FUNCS="
     cexp
 "
 
+MATH_MACROS="
+    isinf
+    isnan
+"
+
 MATH_FUNCS="
     atanf
     atan2f
@@ -1821,8 +1833,6 @@ MATH_FUNCS="
     exp2f
     expf
     hypot
-    isinf
-    isnan
     ldexpf
     llrint
     llrintf
@@ -1950,6 +1960,7 @@ HAVE_LIST="
     $HAVE_LIST_PUB
     $HEADERS_LIST
     $INTRINSICS_LIST
+    $MATH_MACROS
     $MATH_FUNCS
     $SYSTEM_FUNCS
     $THREADS_LIST
@@ -5372,20 +5383,6 @@ disabled  lzma || check_lib2  lzma.h lzma_version_number -llzma || disable lzma
 check_lib math.h sin -lm && LIBM="-lm"
 disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
 
-atan2f_args=2
-copysign_args=2
-hypot_args=2
-ldexpf_args=2
-powf_args=2
-
-for func in $MATH_FUNCS; do
-    eval check_mathfunc $func \${${func}_args:-1}
-done
-
-for func in $COMPLEX_FUNCS; do
-    eval check_complexfunc $func \${${func}_args:-1}
-done
-
 # these are off by default, so fail if requested and not available
 enabled avfoundation_indev && { check_header_objcc AVFoundation/AVFoundation.h || disable avfoundation_indev; }
 enabled avfoundation_indev && { check_lib2 CoreGraphics/CoreGraphics.h CGGetActiveDisplayList -framework CoreGraphics ||
@@ -6021,6 +6018,18 @@ done
 
 enabled zlib && add_cppflags -DZLIB_CONST
 
+for macro in $MATH_MACROS; do
+    eval check_mathmacro $macro
+done
+
+for func in $MATH_FUNCS; do
+    eval check_mathfunc $func
+done
+
+for func in $COMPLEX_FUNCS; do
+    eval check_complexfunc $func
+done
+
 # conditional library dependencies, in linking order
 enabled amovie_filter       && prepend avfilter_deps "avformat avcodec"
 enabled aresample_filter    && prepend avfilter_deps "swresample"
-- 
2.6.4



More information about the ffmpeg-devel mailing list