[x264-devel] configure: test for log2f fails, external reference folded out

Dirk Fieldhouse fieldhouse at gmx.net
Wed Oct 10 13:16:22 CEST 2018


I'm building the 8 October stable version on a MIPS Broadcom 7405 SoC
platform with gcc-4.5.2 and uClibc-0.9.29.

The test at configure l1070 for support of log2f() in libm
(here:<http://git.videolan.org/?p=x264.git;a=blob;f=configure;h=07ba4490f4be6699549c8ac2f2745a0512ccea77;hb=HEAD#l1070>)
succeeds incorrectly.

The program fragment used by configure's cc_check call is

#include <math.h>

int main(void) {

log2f(2);

return 0;
}

gcc 4.5.2 folds the constant expression log2f(2) leaving no external
reference to log2f. It even does this with no optimisation set.
Consequently the build defines HAVE_LOG2F to 1 when in fact there is no
log2f() in the libm provided by this version of uClibc.

Whereas this reference survives:

#include <math.h>

int main(void) {

float x = 2; x = log2f(x);

return 0;
}

I suppose that even this is not guaranteed by the C standard(s) to
survive compile-time evaluation, but it beats this version of gcc.

To implement this, replace configure l1070 by this line

if cc_check 'math.h' '' 'float x = 2; x = log2f(x);' ; then

I'm not subscribed to the list at the moment so please CC: me as well.

thx
/df

-- 
London SW6
UK


More information about the x264-devel mailing list